結果

問題 No.276 連続する整数の和(1)
ユーザー femto
提出日時 2016-01-24 20:57:57
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 307 bytes
コンパイル時間 472 ms
コンパイル使用メモリ 58,976 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-21 16:10:06
合計ジャッジ時間 984 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	int n;
	cin >> n;
	if(n == 1 || n == 2) {
		cout << 1 << endl;
	}
	else if(n % 2 == 0) {
		cout << n / 2 << endl;
	}
	else {
		cout << n << endl;
	}
}
0