結果

問題 No.276 連続する整数の和(1)
ユーザー Lay_ec
提出日時 2015-09-04 22:32:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 470 bytes
コンパイル時間 570 ms
コンパイル使用メモリ 78,620 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-19 00:54:08
合計ジャッジ時間 1,054 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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=(1+n)*n/2;
    cout<<gcd(x,n)<<endl;

    return 0;
}
0