結果

問題 No.141 魔法少女コバ
ユーザー kou6839kou6839
提出日時 2015-02-23 16:24:52
言語 Java21
(openjdk 21)
結果
RE  
実行時間 -
コード長 459 bytes
コンパイル時間 2,091 ms
コンパイル使用メモリ 71,440 KB
実行使用メモリ 58,048 KB
最終ジャッジ日時 2023-09-06 03:09:37
合計ジャッジ時間 17,201 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,112 KB
testcase_01 AC 122 ms
55,636 KB
testcase_02 AC 121 ms
55,528 KB
testcase_03 AC 123 ms
55,556 KB
testcase_04 AC 123 ms
55,580 KB
testcase_05 RE -
testcase_06 RE -
testcase_07 AC 125 ms
55,436 KB
testcase_08 RE -
testcase_09 AC 123 ms
55,884 KB
testcase_10 AC 125 ms
55,824 KB
testcase_11 AC 123 ms
55,588 KB
testcase_12 AC 123 ms
55,740 KB
testcase_13 AC 119 ms
55,496 KB
testcase_14 AC 122 ms
55,872 KB
testcase_15 AC 123 ms
55,540 KB
testcase_16 AC 123 ms
56,076 KB
testcase_17 RE -
testcase_18 AC 124 ms
55,772 KB
testcase_19 AC 123 ms
55,700 KB
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 123 ms
55,856 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 AC 123 ms
55,584 KB
testcase_31 RE -
testcase_32 AC 122 ms
55,952 KB
testcase_33 RE -
testcase_34 RE -
testcase_35 AC 122 ms
55,740 KB
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 AC 124 ms
55,520 KB
testcase_40 RE -
testcase_41 AC 127 ms
55,568 KB
testcase_42 AC 123 ms
55,868 KB
testcase_43 AC 125 ms
55,816 KB
testcase_44 AC 124 ms
55,580 KB
testcase_45 RE -
testcase_46 AC 123 ms
55,540 KB
testcase_47 RE -
testcase_48 RE -
testcase_49 AC 125 ms
55,748 KB
testcase_50 RE -
testcase_51 RE -
testcase_52 AC 123 ms
55,792 KB
testcase_53 RE -
testcase_54 AC 122 ms
55,924 KB
testcase_55 RE -
testcase_56 AC 122 ms
55,532 KB
testcase_57 AC 123 ms
55,864 KB
testcase_58 AC 123 ms
55,824 KB
testcase_59 AC 121 ms
55,616 KB
testcase_60 RE -
testcase_61 RE -
testcase_62 AC 122 ms
55,868 KB
testcase_63 AC 121 ms
53,500 KB
testcase_64 RE -
testcase_65 AC 118 ms
55,620 KB
testcase_66 AC 123 ms
55,580 KB
testcase_67 RE -
testcase_68 AC 122 ms
55,776 KB
testcase_69 RE -
testcase_70 AC 120 ms
55,556 KB
testcase_71 AC 121 ms
55,656 KB
testcase_72 AC 123 ms
55,428 KB
testcase_73 RE -
testcase_74 AC 121 ms
55,620 KB
testcase_75 AC 123 ms
55,768 KB
testcase_76 RE -
testcase_77 RE -
testcase_78 AC 121 ms
55,360 KB
testcase_79 RE -
testcase_80 AC 125 ms
55,756 KB
testcase_81 AC 119 ms
55,812 KB
testcase_82 AC 119 ms
55,504 KB
testcase-evil-0.txt AC 122 ms
55,880 KB
testcase-evil-1.txt RE -
testcase-evil-2.txt AC 123 ms
55,732 KB
testcase-evil-3.txt AC 122 ms
55,816 KB
testcase-evil-4.txt AC 124 ms
56,088 KB
testcase-evil-5.txt AC 124 ms
56,160 KB
testcase-evil-6.txt AC 122 ms
55,868 KB
testcase-evil-7.txt AC 123 ms
55,856 KB
testcase-evil-8.txt AC 124 ms
56,072 KB
testcase-evil-9.txt AC 123 ms
55,920 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.math.*;
import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int x = sc.nextInt();
		int y=sc.nextInt();
		int ans=0;
		while(x!=y){
			if(x>y){
				if(y==1){
				int temp=x/y-1;
				x-=temp*y;
				ans+=temp;
				}else{
					int temp=x/y;
					x-=temp*y;
					ans+=temp;
				}
			}else if(x<y){
				int temp=x;
				x=y;
				y=temp;
				ans++;
			}
		}
		System.out.println(ans);
	}
}
0