結果
問題 | No.1824 門\松\列 |
ユーザー | 🍮かんプリン |
提出日時 | 2022-01-30 08:59:51 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 21 ms / 2,000 ms |
コード長 | 464 bytes |
コンパイル時間 | 2,060 ms |
コンパイル使用メモリ | 165,140 KB |
実行使用メモリ | 10,812 KB |
最終ジャッジ日時 | 2023-09-02 01:29:27 |
合計ジャッジ時間 | 2,147 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
10,708 KB |
testcase_01 | AC | 6 ms
10,696 KB |
testcase_02 | AC | 7 ms
10,812 KB |
testcase_03 | AC | 21 ms
10,544 KB |
testcase_04 | AC | 8 ms
10,764 KB |
ソースコード
/** * @FileName a.cpp * @Author kanpurin * @Created 2022.01.30 08:59:43 **/ #include "bits/stdc++.h" using namespace std; typedef long long ll; int main() { const int max_n = 1000000; vector<ll> dp(max_n+1); dp[3] = 4; for (int i = 4; i <= max_n; i++) { dp[i] = dp[i-1]+(ll)(i-1)*(i-2)*2; } int t;cin >> t; for (int i = 0; i < t; i++) { int n;cin >> n; cout << dp[n] << endl; } return 0; }