結果

問題 No.831 都市めぐり
ユーザー betrue12betrue12
提出日時 2019-05-24 21:46:34
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 298 bytes
コンパイル時間 1,288 ms
コンパイル使用メモリ 166,648 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-17 10:33:28
合計ジャッジ時間 1,982 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int64_t N;
    cin >> N;
    if(N == 1){
        cout << 0 << endl;
        return 0;
    }

    int64_t ans = 5*N-1;
    for(int i=2; i<N; i++){
        ans += 2*i*(N+1-i);
    }
    ans /= 2;
    cout << ans << endl;
    return 0;
}
0