結果

問題 No.141 魔法少女コバ
ユーザー Daigo HIROOKADaigo HIROOKA
提出日時 2018-07-02 10:08:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 128 ms / 5,000 ms
コード長 538 bytes
コンパイル時間 4,761 ms
コンパイル使用メモリ 71,868 KB
実行使用メモリ 56,532 KB
最終ジャッジ日時 2023-09-13 16:53:46
合計ジャッジ時間 20,599 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
55,784 KB
testcase_01 AC 128 ms
55,884 KB
testcase_02 AC 125 ms
55,728 KB
testcase_03 AC 120 ms
55,728 KB
testcase_04 AC 120 ms
55,756 KB
testcase_05 AC 120 ms
55,644 KB
testcase_06 AC 121 ms
55,396 KB
testcase_07 AC 119 ms
53,832 KB
testcase_08 AC 119 ms
53,828 KB
testcase_09 AC 119 ms
55,588 KB
testcase_10 AC 119 ms
55,488 KB
testcase_11 AC 120 ms
55,744 KB
testcase_12 AC 120 ms
55,656 KB
testcase_13 AC 121 ms
55,496 KB
testcase_14 AC 121 ms
55,492 KB
testcase_15 AC 120 ms
55,996 KB
testcase_16 AC 120 ms
55,900 KB
testcase_17 AC 120 ms
56,248 KB
testcase_18 AC 122 ms
55,540 KB
testcase_19 AC 118 ms
55,648 KB
testcase_20 AC 119 ms
55,792 KB
testcase_21 AC 119 ms
55,744 KB
testcase_22 AC 121 ms
55,860 KB
testcase_23 AC 120 ms
56,236 KB
testcase_24 AC 121 ms
55,892 KB
testcase_25 AC 120 ms
55,716 KB
testcase_26 AC 119 ms
55,664 KB
testcase_27 AC 120 ms
55,780 KB
testcase_28 AC 119 ms
55,784 KB
testcase_29 AC 120 ms
55,628 KB
testcase_30 AC 120 ms
56,124 KB
testcase_31 AC 119 ms
55,984 KB
testcase_32 AC 120 ms
55,752 KB
testcase_33 AC 119 ms
55,680 KB
testcase_34 AC 121 ms
56,080 KB
testcase_35 AC 119 ms
55,972 KB
testcase_36 AC 121 ms
56,012 KB
testcase_37 AC 119 ms
55,820 KB
testcase_38 AC 118 ms
55,908 KB
testcase_39 AC 120 ms
55,896 KB
testcase_40 AC 119 ms
55,620 KB
testcase_41 AC 120 ms
55,652 KB
testcase_42 AC 122 ms
55,644 KB
testcase_43 AC 122 ms
55,844 KB
testcase_44 AC 119 ms
55,968 KB
testcase_45 AC 121 ms
55,908 KB
testcase_46 AC 120 ms
55,788 KB
testcase_47 AC 119 ms
55,752 KB
testcase_48 AC 120 ms
55,612 KB
testcase_49 AC 119 ms
55,460 KB
testcase_50 AC 127 ms
55,796 KB
testcase_51 AC 119 ms
55,544 KB
testcase_52 AC 119 ms
56,012 KB
testcase_53 AC 120 ms
56,060 KB
testcase_54 AC 121 ms
55,624 KB
testcase_55 AC 120 ms
56,136 KB
testcase_56 AC 125 ms
55,672 KB
testcase_57 AC 121 ms
56,020 KB
testcase_58 AC 119 ms
56,016 KB
testcase_59 AC 119 ms
56,044 KB
testcase_60 AC 119 ms
56,004 KB
testcase_61 AC 119 ms
56,532 KB
testcase_62 AC 120 ms
56,008 KB
testcase_63 AC 125 ms
55,712 KB
testcase_64 AC 121 ms
55,928 KB
testcase_65 AC 118 ms
55,648 KB
testcase_66 AC 121 ms
56,392 KB
testcase_67 AC 118 ms
53,612 KB
testcase_68 AC 119 ms
56,096 KB
testcase_69 AC 119 ms
55,944 KB
testcase_70 AC 121 ms
54,192 KB
testcase_71 AC 119 ms
56,292 KB
testcase_72 AC 118 ms
55,888 KB
testcase_73 AC 120 ms
55,692 KB
testcase_74 AC 124 ms
55,484 KB
testcase_75 AC 120 ms
55,904 KB
testcase_76 AC 120 ms
55,744 KB
testcase_77 AC 120 ms
56,084 KB
testcase_78 AC 122 ms
55,788 KB
testcase_79 AC 121 ms
55,916 KB
testcase_80 AC 121 ms
56,068 KB
testcase_81 AC 123 ms
56,264 KB
testcase_82 AC 122 ms
55,848 KB
testcase-evil-0.txt AC 399 ms
55,616 KB
testcase-evil-1.txt AC 121 ms
55,676 KB
testcase-evil-2.txt AC 128 ms
55,612 KB
testcase-evil-3.txt AC 128 ms
55,748 KB
testcase-evil-4.txt AC 124 ms
53,720 KB
testcase-evil-5.txt AC 267 ms
56,084 KB
testcase-evil-6.txt AC 196 ms
56,024 KB
testcase-evil-7.txt AC 122 ms
55,740 KB
testcase-evil-8.txt AC 203 ms
56,096 KB
testcase-evil-9.txt AC 145 ms
55,740 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

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

		int m = sc.nextInt();
		int n = sc.nextInt();
		int x = m, y = n, tmp;
		while((tmp = x%y) != 0){
			x = y;
			y = tmp;
		}
		if(y > 1){
			m /= y;
			n /= y;
		}

		int count = 0;
		while(m != n){
			if(n == 1){
				count += m-1;
				break;
			}
			if(m > n){
				m -= n;
			}
			else{
				int l = m;
				m = n;
				n = l;
			}
			// System.out.println(m+"/"+n);
			count++;
		}
		System.out.println(count);
	}
}
0