結果

問題 No.1824 門\松\列
ユーザー koanviolinkoanviolin
提出日時 2022-01-28 22:00:49
言語 Java21
(openjdk 21)
結果
AC  
実行時間 366 ms / 2,000 ms
コード長 389 bytes
コンパイル時間 2,023 ms
コンパイル使用メモリ 71,664 KB
実行使用メモリ 61,088 KB
最終ジャッジ日時 2023-08-28 19:56:39
合計ジャッジ時間 3,848 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 138 ms
55,764 KB
testcase_01 AC 120 ms
56,140 KB
testcase_02 AC 217 ms
57,208 KB
testcase_03 AC 366 ms
61,088 KB
testcase_04 AC 232 ms
57,336 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedInputStream;
import java.util.*;

public class Main {

    public static void main(String[] argv){
        Scanner sc = new Scanner(System.in);
        long t= sc.nextLong();
        while(t>0) {
            t--;
            long n = sc.nextLong();
            long k = (n-2)*(n-1)*(2*n-3)/3 + (n -2 ) * (n-1);
            System.out.println(k);
        }


    }
}
0