結果

問題 No.276 連続する整数の和(1)
ユーザー ldsyb
提出日時 2016-03-15 01:03:17
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 276 bytes
コンパイル時間 440 ms
コンパイル使用メモリ 54,552 KB
実行使用メモリ 13,764 KB
最終ジャッジ日時 2024-10-01 06:30:55
合計ジャッジ時間 3,144 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 2 WA * 4 TLE * 1 -- * 3
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

long long gcd(int x,long long y){
   if((x == 0) || (y == 0)) return 0;
   while(x != y){
      if(x > y) x -= y;
      else y -= x;
   }
   return x;
}

int main(){
   int n;
   cin >> n;
   cout << gcd(n,(n - 1) * n / 2) << endl;
}
0