結果

問題 No.71 そろばん
ユーザー youjo_yamiotiyoujo_yamioti
提出日時 2018-12-07 04:49:28
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 243 bytes
コンパイル時間 1,408 ms
コンパイル使用メモリ 157,944 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 03:13:11
合計ジャッジ時間 2,268 ms
ジャッジサーバーID
(参考情報)
judge6 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
long int N;
long int NUM(long int P){
    return -P*P + N*P + N;
}
int main(){
    cin >> N;
    if(N%2==0) cout << (N/2) * (N/2) + N << endl;
    else cout << NUM((N+1)/2) << endl;
    return 0;
}
0