結果

問題 No.1491 銀将
ユーザー Manuel1024
提出日時 2021-04-30 22:25:19
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 481 bytes
コンパイル時間 562 ms
コンパイル使用メモリ 65,048 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-19 01:56:12
合計ジャッジ時間 1,292 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;
using ll = long long int;

int main(){
    ll n;
    cin >> n;
    ll ans = 0;
    ans += (((n-1)/2)*4+3) * ((n+1)/2);
    ans += ((n/2)*4+1) * ((n+2)/2);
    ans += n*2+1;
    //cerr << ans << endl;
    //cerr << (n-(1-n%2))*2+1 << " " << ((n/2)*2)*2+1 << " " << n*2+1 << endl;
    ans += (((n/2)*2+n%2)*2+1)*((n-1)/2);//((n/2)*2+n%2)*2+1
    ans += (((n/2)*2)*2+1)*((n-2)/2);
    if(n == 1) ans--;
    cout << ans << endl;
    return 0;
}
0