結果
| 問題 |
No.276 連続する整数の和(1)
|
| コンテスト | |
| ユーザー |
tenten
|
| 提出日時 | 2020-10-05 09:36:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 138 ms / 1,000 ms |
| コード長 | 414 bytes |
| コンパイル時間 | 2,326 ms |
| コンパイル使用メモリ | 73,824 KB |
| 実行使用メモリ | 41,384 KB |
| 最終ジャッジ日時 | 2024-07-19 19:23:08 |
| 合計ジャッジ時間 | 4,112 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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