結果
| 問題 |
No.1824 門\松\列
|
| コンテスト | |
| ユーザー |
🍮かんプリン
|
| 提出日時 | 2022-01-30 08:59:51 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 23 ms / 2,000 ms |
| コード長 | 464 bytes |
| コンパイル時間 | 1,465 ms |
| コンパイル使用メモリ | 168,300 KB |
| 実行使用メモリ | 11,160 KB |
| 最終ジャッジ日時 | 2024-06-11 08:09:09 |
| 合計ジャッジ時間 | 1,956 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 4 |
ソースコード
/**
* @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;
}
🍮かんプリン