結果
| 問題 | No.276 連続する整数の和(1) |
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-10-05 09:36:48 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 56 ms / 1,000 ms |
| コード長 | 414 bytes |
| 記録 | |
| コンパイル時間 | 2,662 ms |
| コンパイル使用メモリ | 82,180 KB |
| 実行使用メモリ | 128,688 KB |
| 最終ジャッジ日時 | 2026-04-02 18:00:22 |
| 合計ジャッジ時間 | 2,779 ms |
|
ジャッジサーバーID (参考情報) |
judge5_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
ソースコード
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
long x = getGCD(n, (long)n * (n + 1) / 2);
System.out.println(x);
}
static long getGCD(long x, long y) {
if (x % y == 0) {
return y;
} else {
return getGCD(y, x % y);
}
}
}
tenten