結果

問題 No.276 連続する整数の和(1)
ユーザー ldsybldsyb
提出日時 2016-03-15 01:03:17
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 276 bytes
コンパイル時間 665 ms
コンパイル使用メモリ 55,328 KB
実行使用メモリ 13,480 KB
最終ジャッジ日時 2024-04-08 13:14:28
合計ジャッジ時間 3,100 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
13,480 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 TLE -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
権限があれば一括ダウンロードができます

ソースコード

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