結果

問題 No.415 ぴょん
ユーザー ぴろずぴろず
提出日時 2016-08-26 22:23:18
言語 Java21
(openjdk 21)
結果
AC  
実行時間 126 ms / 1,000 ms
コード長 355 bytes
コンパイル時間 1,992 ms
コンパイル使用メモリ 71,608 KB
実行使用メモリ 56,132 KB
最終ジャッジ日時 2023-08-11 20:14:23
合計ジャッジ時間 6,475 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
55,708 KB
testcase_01 AC 123 ms
56,000 KB
testcase_02 AC 122 ms
55,868 KB
testcase_03 AC 125 ms
55,788 KB
testcase_04 AC 124 ms
53,396 KB
testcase_05 AC 124 ms
55,636 KB
testcase_06 AC 124 ms
55,924 KB
testcase_07 AC 124 ms
55,652 KB
testcase_08 AC 123 ms
56,008 KB
testcase_09 AC 124 ms
55,936 KB
testcase_10 AC 124 ms
55,912 KB
testcase_11 AC 123 ms
55,916 KB
testcase_12 AC 123 ms
56,036 KB
testcase_13 AC 124 ms
56,064 KB
testcase_14 AC 124 ms
55,836 KB
testcase_15 AC 123 ms
55,652 KB
testcase_16 AC 124 ms
55,768 KB
testcase_17 AC 123 ms
55,948 KB
testcase_18 AC 124 ms
55,768 KB
testcase_19 AC 126 ms
55,960 KB
testcase_20 AC 123 ms
56,132 KB
testcase_21 AC 121 ms
53,836 KB
testcase_22 AC 126 ms
55,604 KB
testcase_23 AC 122 ms
55,960 KB
testcase_24 AC 122 ms
55,672 KB
testcase_25 AC 123 ms
55,468 KB
testcase_26 AC 122 ms
55,612 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no415;

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);
	}
	public static long gcd(long a,long b) {
		while(b!=0) {
			long r = a%b;
			a = b;
			b = r;
		}
		return a;
	}
}
0