結果
| 問題 | 
                            No.831 都市めぐり
                             | 
                    
| コンテスト | |
| ユーザー | 
                             aya_se
                         | 
                    
| 提出日時 | 2019-05-24 21:53:08 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 484 bytes | 
| コンパイル時間 | 567 ms | 
| コンパイル使用メモリ | 65,332 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-09-17 10:36:55 | 
| 合計ジャッジ時間 | 1,231 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 WA * 1 | 
| other | AC * 1 WA * 17 | 
ソースコード
#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;
	}
}
            
            
            
        
            
aya_se