結果
| 問題 | No.415 ぴょん |
| コンテスト | |
| ユーザー |
samplelpmas
|
| 提出日時 | 2017-04-26 18:33:21 |
| 言語 | Java (openjdk 25.0.2) |
| 結果 |
AC
|
| 実行時間 | 57 ms / 1,000 ms |
| コード長 | 454 bytes |
| 記録 | |
| コンパイル時間 | 1,956 ms |
| コンパイル使用メモリ | 82,156 KB |
| 実行使用メモリ | 41,972 KB |
| 最終ジャッジ日時 | 2026-05-13 03:14:31 |
| 合計ジャッジ時間 | 5,180 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge1_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
long N = sc.nextLong();
long D = sc.nextLong();
System.out.println(N / gcd(N, D) - 1);
}
private static long gcd(long a, long b) {
while (b > 0) {
long remainder = a % b;
a = b;
b = remainder;
}
return a;
}
}
samplelpmas