結果

問題 No.831 都市めぐり
コンテスト
ユーザー aya_se
提出日時 2019-05-24 21:53:08
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 484 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 473 ms
コンパイル使用メモリ 84,036 KB
実行使用メモリ 7,976 KB
最終ジャッジ日時 2026-04-06 06:11:09
合計ジャッジ時間 984 ms
ジャッジサーバーID
(参考情報)
judge2_1 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 1 WA * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <iostream>
#include <string>
#include <vector>
#include<algorithm>
#include <iomanip>
using namespace std;
typedef long long ll;
//定義場所//
ll i, j, k, l, m, n;
ll N;
////////////

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