結果

問題 No.2174 3 O'clock Easy
ユーザー forest3
提出日時 2025-03-13 16:21:59
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 418 bytes
コンパイル時間 1,774 ms
コンパイル使用メモリ 161,140 KB
実行使用メモリ 7,328 KB
最終ジャッジ日時 2025-03-13 16:22:02
合計ジャッジ時間 2,238 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 3 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;
#define rep(i, n) for(ll i = 0; i < n; i++)

int main() {
	int N;
	cin >> N;
	ll ans = 0;
	for(int i = 1; i <= N; i++) {
		ll k = i / 3, m = i % 3;
		if(m) {
			m = 3 - m;
			k++;
			if(m == 1) ans += 3 * k - 2;
			else {
				ll a = 3 * k - 1;
				ans += a * a;
			}
		}
		else {
			ll a = 3 * k;
			ans += a * a * a;
		}
	}
	cout << ans << endl;
} 
0