結果

問題 No.276 連続する整数の和(1)
ユーザー DaYuanChiDaYuanChi
提出日時 2021-02-06 15:57:14
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 215 bytes
コンパイル時間 1,641 ms
コンパイル使用メモリ 166,376 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-03 01:29:04
合計ジャッジ時間 2,849 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
  int n; cin >> n;
  //和=(2a+n-1)n/2
  int ans = 0;
  if(n%2==0) ans = n / 2;
  else ans = n;
  cout << ans << endl;
  return 0;
}
0