結果
問題 |
No.1824 門\松\列
|
ユーザー |
|
提出日時 | 2022-01-28 23:58:02 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 10 ms / 2,000 ms |
コード長 | 413 bytes |
コンパイル時間 | 1,828 ms |
コンパイル使用メモリ | 166,776 KB |
実行使用メモリ | 18,956 KB |
最終ジャッジ日時 | 2024-12-30 13:09:25 |
合計ジャッジ時間 | 2,764 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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'; } }