結果
| 問題 | No.1824 門\松\列 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-01-28 23:58:02 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
AC
|
| 実行時間 | 10 ms / 2,000 ms |
| コード長 | 413 bytes |
| 記録 | |
| コンパイル時間 | 973 ms |
| コンパイル使用メモリ | 178,636 KB |
| 実行使用メモリ | 19,328 KB |
| 最終ジャッジ日時 | 2026-06-04 02:56:12 |
| 合計ジャッジ時間 | 1,799 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
long long ans1[1000006];
long long ans2[1000006];
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
ans1[3]=2,ans2[3]=2;
for(long long i=4;i<1000006;i++){
ans1[i]=ans1[i-1]+(i-2)*(i-1);
ans2[i]=ans2[i-1]+(i-2)*(i-1);
}
int test_case;
cin>>test_case;
while (test_case--){
int N;
cin>>N;
cout<<ans1[N]+ans2[N]<<'\n';
}
}