結果

問題 No.141 魔法少女コバ
ユーザー 37zigen37zigen
提出日時 2016-05-02 00:11:31
言語 Java21
(openjdk 21)
結果
AC  
実行時間 169 ms / 5,000 ms
コード長 650 bytes
コンパイル時間 2,652 ms
コンパイル使用メモリ 77,572 KB
実行使用メモリ 42,092 KB
最終ジャッジ日時 2024-04-15 08:39:12
合計ジャッジ時間 20,526 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 165 ms
41,804 KB
testcase_01 AC 161 ms
41,796 KB
testcase_02 AC 163 ms
41,844 KB
testcase_03 AC 160 ms
41,304 KB
testcase_04 AC 164 ms
41,648 KB
testcase_05 AC 155 ms
41,620 KB
testcase_06 AC 153 ms
41,648 KB
testcase_07 AC 158 ms
41,820 KB
testcase_08 AC 158 ms
41,316 KB
testcase_09 AC 157 ms
41,312 KB
testcase_10 AC 159 ms
41,500 KB
testcase_11 AC 162 ms
41,528 KB
testcase_12 AC 162 ms
41,668 KB
testcase_13 AC 166 ms
41,568 KB
testcase_14 AC 153 ms
41,640 KB
testcase_15 AC 164 ms
41,664 KB
testcase_16 AC 168 ms
41,872 KB
testcase_17 AC 169 ms
41,564 KB
testcase_18 AC 158 ms
41,768 KB
testcase_19 AC 160 ms
41,376 KB
testcase_20 AC 150 ms
42,092 KB
testcase_21 AC 161 ms
41,912 KB
testcase_22 AC 161 ms
41,780 KB
testcase_23 AC 156 ms
41,648 KB
testcase_24 AC 162 ms
41,428 KB
testcase_25 AC 159 ms
41,440 KB
testcase_26 AC 157 ms
41,344 KB
testcase_27 AC 158 ms
41,632 KB
testcase_28 AC 162 ms
41,864 KB
testcase_29 AC 152 ms
41,956 KB
testcase_30 AC 156 ms
41,412 KB
testcase_31 AC 157 ms
41,696 KB
testcase_32 AC 159 ms
41,488 KB
testcase_33 AC 159 ms
41,672 KB
testcase_34 AC 154 ms
41,980 KB
testcase_35 AC 166 ms
41,456 KB
testcase_36 AC 157 ms
41,988 KB
testcase_37 AC 160 ms
41,624 KB
testcase_38 AC 157 ms
41,248 KB
testcase_39 AC 157 ms
41,844 KB
testcase_40 AC 154 ms
41,804 KB
testcase_41 AC 163 ms
41,388 KB
testcase_42 AC 168 ms
41,300 KB
testcase_43 AC 163 ms
41,796 KB
testcase_44 AC 162 ms
41,200 KB
testcase_45 AC 163 ms
41,804 KB
testcase_46 AC 164 ms
41,528 KB
testcase_47 AC 163 ms
41,664 KB
testcase_48 AC 161 ms
41,736 KB
testcase_49 AC 164 ms
41,872 KB
testcase_50 AC 157 ms
41,400 KB
testcase_51 AC 162 ms
41,588 KB
testcase_52 AC 160 ms
41,972 KB
testcase_53 AC 156 ms
41,360 KB
testcase_54 AC 169 ms
41,776 KB
testcase_55 AC 160 ms
41,736 KB
testcase_56 AC 163 ms
41,692 KB
testcase_57 AC 164 ms
42,052 KB
testcase_58 AC 159 ms
41,572 KB
testcase_59 AC 165 ms
41,460 KB
testcase_60 AC 154 ms
41,512 KB
testcase_61 AC 155 ms
41,512 KB
testcase_62 AC 160 ms
41,648 KB
testcase_63 AC 164 ms
41,812 KB
testcase_64 AC 163 ms
41,700 KB
testcase_65 AC 160 ms
41,696 KB
testcase_66 AC 160 ms
41,700 KB
testcase_67 AC 158 ms
41,472 KB
testcase_68 AC 139 ms
40,156 KB
testcase_69 AC 159 ms
41,756 KB
testcase_70 AC 155 ms
41,428 KB
testcase_71 AC 155 ms
41,704 KB
testcase_72 AC 165 ms
41,480 KB
testcase_73 AC 155 ms
41,484 KB
testcase_74 AC 154 ms
41,424 KB
testcase_75 AC 156 ms
41,348 KB
testcase_76 AC 153 ms
41,524 KB
testcase_77 AC 161 ms
41,616 KB
testcase_78 AC 159 ms
41,932 KB
testcase_79 AC 158 ms
41,672 KB
testcase_80 AC 166 ms
41,384 KB
testcase_81 AC 163 ms
41,744 KB
testcase_82 AC 157 ms
41,648 KB
testcase-evil-0.txt AC 161 ms
41,564 KB
testcase-evil-1.txt AC 165 ms
41,764 KB
testcase-evil-2.txt AC 161 ms
42,068 KB
testcase-evil-3.txt AC 159 ms
41,808 KB
testcase-evil-4.txt AC 157 ms
42,188 KB
testcase-evil-5.txt AC 163 ms
41,560 KB
testcase-evil-6.txt AC 160 ms
41,596 KB
testcase-evil-7.txt AC 160 ms
41,764 KB
testcase-evil-8.txt AC 168 ms
41,284 KB
testcase-evil-9.txt AC 155 ms
41,916 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder;
import java.util.Scanner;
public class Main{
	public static void main(String[] args)throws Exception{
		new Main().solve();
	}
	void solve(){
		Scanner sc=new Scanner(System.in);
		long m=sc.nextLong();
		long n=sc.nextLong();
		
		long gcd=GCD(m,n);
		m/=gcd;
		n/=gcd;
		
		count=0;
		GCD(m,n);
		System.out.println(count-2);
	}
	int count=0;
	long LCM(long t1,long t2){
		long a=GCD(t1,t2);
		long tt1=t1/a;
		long tt2=t2/a;
		return tt1*tt2*a;
	}
	//t1>t2
	long GCD(long t1,long t2){
		if(t1<t2){
			long d=t2;
			t2=t1;
			t1=d;
			count++;
		}
		if(t2==0)return t1;
		else{
			count+=t1/t2;
			return GCD(t1%t2,t2);
		}
	}
}
0