結果

問題 No.1824 門\松\列
ユーザー pengin_2000pengin_2000
提出日時 2022-07-21 14:20:38
言語 C
(gcc 12.3.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 338 bytes
コンパイル時間 226 ms
コンパイル使用メモリ 27,860 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-15 15:43:10
合計ジャッジ時間 699 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 0 ms
4,384 KB
testcase_02 AC 1 ms
4,384 KB
testcase_03 AC 3 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
int main()
{
	int t;
	scanf("%d", &t);
	long long int n;
	long long int ans;
	for (; t > 0; t--)
	{
		scanf("%lld", &n);
		ans = n * (n + 1) * (2 * n + 1) / 6 - (2 * n - 1) * n * (n + 1) / 2 + n * n * (n - 1);
		ans += n * (n + 1) * (2 * n + 1) / 6 - 3 * n * (n + 1) / 2 + 2 * n;
		printf("%lld\n", ans);
	}
	return 0;
}
0