結果
問題 | No.276 連続する整数の和(1) |
ユーザー |
![]() |
提出日時 | 2015-09-07 06:37:56 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 282 bytes |
コンパイル時間 | 1,233 ms |
コンパイル使用メモリ | 158,448 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-19 04:52:11 |
合計ジャッジ時間 | 1,706 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include <bits/stdc++.h>using namespace std;typedef long long int ll;ll gcd(ll a,ll b){if(a<b) a^=b,b^=a,a^=b;if(b==0) return 1;while(a%b!=0){ll tmp=a%b;a=b; b=tmp;}return b;}int main(){ll n; cin>>n;ll x=n*(n-1)/2;x=gcd(n,x);cout<<x<<endl;return 0;}