結果
| 問題 |
No.276 連続する整数の和(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-09-30 19:54:32 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 353 bytes |
| コンパイル時間 | 107 ms |
| コンパイル使用メモリ | 28,672 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-12 09:16:35 |
| 合計ジャッジ時間 | 645 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
#include <stdio.h>
long gcd(long x, long y)
{
long r;
if (y > x) {
r = x;
x = y;
y = r;
}
while (y > 0) {
r = x % y;
x = y;
y = r;
}
return x;
}
int main(void)
{
long N;
scanf("%ld", &N);
printf("%ld", gcd(N, (N - 1) * N / 2));
return 0;
}