結果
問題 | No.276 連続する整数の和(1) |
ユーザー |
![]() |
提出日時 | 2016-04-05 16:36:04 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 393 bytes |
コンパイル時間 | 519 ms |
コンパイル使用メモリ | 54,584 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2024-10-04 01:20:25 |
合計ジャッジ時間 | 1,062 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
ソースコード
#include<iostream>using namespace std;unsigned long long gcd(unsigned long long a, unsigned long long b);int main(){unsigned long long n;cin >> n;cout << gcd(n*(n + 1) / 2, n) << endl;return 0;}unsigned long long gcd(unsigned long long a, unsigned long long b){int c;if (a < b) {c = a;a = b;b = c;}while (b != 0) {c = a%b;a = b;b = c;}return a;}