結果

問題 No.1824 門\松\列
ユーザー ks2mks2m
提出日時 2022-01-28 22:29:46
言語 Java21
(openjdk 21)
結果
AC  
実行時間 298 ms / 2,000 ms
コード長 486 bytes
コンパイル時間 2,274 ms
コンパイル使用メモリ 71,240 KB
実行使用メモリ 66,900 KB
最終ジャッジ日時 2023-08-28 20:37:50
合計ジャッジ時間 3,978 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 140 ms
62,476 KB
testcase_01 AC 132 ms
62,196 KB
testcase_02 AC 208 ms
62,724 KB
testcase_03 AC 298 ms
66,900 KB
testcase_04 AC 210 ms
62,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.PrintWriter;
import java.util.Scanner;

public class Main {
	public static void main(String[] args) throws Exception {
		Scanner sc = new Scanner(System.in);
		int t= sc.nextInt();

		long[] x = new long[1000001];
		for (int i = 1; i < x.length; i++) {
			x[i] = (long) i * (i + 1) + x[i - 1];
		}

		PrintWriter pw = new PrintWriter(System.out);
		for (int z = 0; z < t; z++) {
			int n = sc.nextInt();

			pw.println(x[n - 2] * 2);
		}
		pw.flush();
		sc.close();
	}
}
0