結果

問題 No.2174 3 O'clock Easy
ユーザー ID 21712
提出日時 2025-02-11 03:00:19
言語 Standard ML
(MLton 20210117)
結果
AC  
実行時間 1 ms / 2,000 ms
コード長 289 bytes
コンパイル時間 3,533 ms
コンパイル使用メモリ 691,960 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2025-02-11 03:00:24
合計ジャッジ時間 4,694 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

val n = valOf (TextIO.scanStream (LargeInt.scan StringCvt.DEC) TextIO.stdIn);

val k = n div 3;

val s1 = k * (k + 1) div 2;

val a1 = if 3*k+1 = n then n else 0;
val a2 = if 3*k+2 = n then n*(n+1)-1 else 0;
val a3 = (27*s1+3*(2*k+1)-3)*s1-k;

print (LargeInt.toString (a1+a2+a3) ^ "\n");
0