Source Code
import java.util.*;
public class Main {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int t= in.nextInt();
        while(t-->0) {
            long n = in.nextInt();
            System.out.println((long) (n*n*n+n)/2);
        }
    }
}
Copy
Ali's Game Ayman_Attili
Java 11
2080 ms
97.9 MB
Time Limit Exceeded