結果

問題 No.276 連続する整数の和(1)
ユーザー Lay_ec
提出日時 2015-09-04 23:02:46
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 470 bytes
コンパイル時間 548 ms
コンパイル使用メモリ 78,508 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-19 01:38:30
合計ジャッジ時間 1,160 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <map>
#include <queue>
#include <stack>

using namespace std;

long long gcd(long long x,long long y){
    return y==0 ? x : gcd(y,x%y);
}

int main()
{

    long long n;
    cin>>n;
    
    long long x=gcd(n,(1+n)*n/2);
    cout<<x<<endl;

    return 0;
}
0