結果

問題 No.415 ぴょん
ユーザー TatsuDX
提出日時 2016-09-03 17:13:06
言語 Java
(openjdk 23)
結果
AC  
実行時間 123 ms / 1,000 ms
コード長 294 bytes
コンパイル時間 3,203 ms
コンパイル使用メモリ 74,568 KB
実行使用メモリ 54,224 KB
最終ジャッジ日時 2024-11-18 14:46:43
合計ジャッジ時間 7,186 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Test {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);

		long n = sc.nextLong(), m = sc.nextLong(), a = n, b = m, tmp = n%m;
		while(tmp > 0){
			a = b;
			b = tmp;
			tmp = a % b;
		}
		System.out.println((n/b)-1);
	}
}
0