結果

問題 No.1824 門\松\列
ユーザー se1ka2se1ka2
提出日時 2022-01-28 21:28:15
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 21 ms / 2,000 ms
コード長 284 bytes
コンパイル時間 509 ms
コンパイル使用メモリ 65,416 KB
実行使用メモリ 11,376 KB
最終ジャッジ日時 2023-08-28 19:08:53
合計ジャッジ時間 986 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
11,140 KB
testcase_01 AC 4 ms
11,236 KB
testcase_02 AC 5 ms
11,376 KB
testcase_03 AC 21 ms
11,120 KB
testcase_04 AC 6 ms
11,252 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <iostream>
using namespace std;
typedef long long ll;

int main()
{
	ll s[1000005];
	s[0] = 0;
	for(ll i = 1; i <= 1000000; i++){
		s[i] = s[i - 1] + i * i - i;
	}
	int t;
	cin >> t;
	while(t--){
		int n;
		cin >> n;
		cout << s[n - 1] * 2 << endl;
	}
}
0