Submission #00167


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <bits/stdc++.h>
using namespace std;
#define endl "\n"
#define inf 1001001001
template<class T> bool chmax(T &a, const T &b) { if(a < b) {a = b; return true;} return false; }
template<class T> bool chmin(T &a, const T &b) { if(b < a) {a = b; return true;} return false; }
//================================================================================================
int main(){
int n, ans = 0;
cin >> n;
for(int i = 1; i <= n; i += 2){
ans += i;
}
cout << ans << endl;
return(0);
}

ステータス

項目 データ
問題 0007 - 偶数嫌いのユタカくん
ユーザー名 ei2212
投稿日時 2024-04-26 16:17:33
言語 C++17
状態 Accepted
得点 10
ソースコード長 544 Byte
最大実行時間 23 ms
最大メモリ使用量 504 KB

セット

セット 得点 Cases
1 ALL 10 / 10 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
in1.txt AC 22 ms 476 KB
1
in2.txt AC 22 ms 448 KB
1
in3.txt AC 22 ms 420 KB
1
in4.txt AC 19 ms 396 KB
1
in5.txt AC 21 ms 372 KB
1
in6.txt AC 20 ms 468 KB
1
insample1.txt AC 20 ms 436 KB
1
insample2.txt AC 23 ms 404 KB
1
insample3.txt AC 23 ms 504 KB
1