結果

問題 No.141 魔法少女コバ
ユーザー crazybbb3crazybbb3
提出日時 2017-01-29 22:00:29
言語 Java21
(openjdk 21)
結果
AC  
実行時間 614 ms / 5,000 ms
コード長 1,950 bytes
コンパイル時間 4,088 ms
コンパイル使用メモリ 73,856 KB
実行使用メモリ 50,176 KB
最終ジャッジ日時 2023-08-25 15:10:19
合計ジャッジ時間 13,128 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
47,816 KB
testcase_01 AC 614 ms
50,132 KB
testcase_02 AC 611 ms
50,020 KB
testcase_03 AC 44 ms
49,548 KB
testcase_04 AC 44 ms
49,628 KB
testcase_05 AC 44 ms
49,608 KB
testcase_06 AC 44 ms
49,712 KB
testcase_07 AC 44 ms
49,516 KB
testcase_08 AC 43 ms
49,876 KB
testcase_09 AC 45 ms
49,624 KB
testcase_10 AC 44 ms
49,492 KB
testcase_11 AC 44 ms
49,504 KB
testcase_12 AC 44 ms
49,744 KB
testcase_13 AC 44 ms
49,892 KB
testcase_14 AC 44 ms
47,512 KB
testcase_15 AC 44 ms
47,716 KB
testcase_16 AC 47 ms
49,528 KB
testcase_17 AC 46 ms
49,620 KB
testcase_18 AC 45 ms
49,540 KB
testcase_19 AC 45 ms
50,056 KB
testcase_20 AC 45 ms
49,616 KB
testcase_21 AC 45 ms
49,700 KB
testcase_22 AC 46 ms
49,476 KB
testcase_23 AC 50 ms
49,508 KB
testcase_24 AC 49 ms
50,032 KB
testcase_25 AC 46 ms
49,484 KB
testcase_26 AC 45 ms
49,516 KB
testcase_27 AC 46 ms
49,700 KB
testcase_28 AC 45 ms
49,640 KB
testcase_29 AC 45 ms
49,676 KB
testcase_30 AC 45 ms
49,620 KB
testcase_31 AC 44 ms
49,604 KB
testcase_32 AC 50 ms
49,480 KB
testcase_33 AC 44 ms
49,552 KB
testcase_34 AC 44 ms
49,524 KB
testcase_35 AC 44 ms
49,628 KB
testcase_36 AC 44 ms
50,012 KB
testcase_37 AC 43 ms
49,600 KB
testcase_38 AC 43 ms
49,460 KB
testcase_39 AC 44 ms
49,492 KB
testcase_40 AC 43 ms
49,532 KB
testcase_41 AC 44 ms
49,508 KB
testcase_42 AC 44 ms
49,588 KB
testcase_43 AC 44 ms
50,176 KB
testcase_44 AC 47 ms
49,572 KB
testcase_45 AC 45 ms
49,636 KB
testcase_46 AC 45 ms
49,592 KB
testcase_47 AC 44 ms
49,524 KB
testcase_48 AC 44 ms
49,440 KB
testcase_49 AC 44 ms
49,612 KB
testcase_50 AC 44 ms
49,752 KB
testcase_51 AC 45 ms
49,476 KB
testcase_52 AC 44 ms
49,628 KB
testcase_53 AC 44 ms
49,564 KB
testcase_54 AC 45 ms
49,616 KB
testcase_55 AC 45 ms
49,744 KB
testcase_56 AC 44 ms
49,612 KB
testcase_57 AC 44 ms
47,488 KB
testcase_58 AC 45 ms
49,548 KB
testcase_59 AC 44 ms
49,604 KB
testcase_60 AC 44 ms
49,472 KB
testcase_61 AC 44 ms
49,464 KB
testcase_62 AC 44 ms
49,580 KB
testcase_63 AC 43 ms
49,512 KB
testcase_64 AC 44 ms
49,536 KB
testcase_65 AC 44 ms
49,524 KB
testcase_66 AC 44 ms
49,544 KB
testcase_67 AC 45 ms
49,512 KB
testcase_68 AC 44 ms
49,520 KB
testcase_69 AC 44 ms
49,680 KB
testcase_70 AC 44 ms
49,620 KB
testcase_71 AC 44 ms
49,932 KB
testcase_72 AC 43 ms
49,772 KB
testcase_73 AC 47 ms
49,820 KB
testcase_74 AC 44 ms
49,632 KB
testcase_75 AC 44 ms
49,528 KB
testcase_76 AC 44 ms
49,620 KB
testcase_77 AC 44 ms
49,552 KB
testcase_78 AC 44 ms
49,640 KB
testcase_79 AC 44 ms
49,424 KB
testcase_80 AC 45 ms
49,612 KB
testcase_81 AC 45 ms
49,468 KB
testcase_82 AC 45 ms
49,624 KB
testcase-evil-0.txt AC 330 ms
50,072 KB
testcase-evil-1.txt AC 227 ms
50,140 KB
testcase-evil-2.txt AC 99 ms
50,076 KB
testcase-evil-3.txt AC 143 ms
50,220 KB
testcase-evil-4.txt AC 441 ms
50,068 KB
testcase-evil-5.txt AC 190 ms
50,472 KB
testcase-evil-6.txt AC 124 ms
50,404 KB
testcase-evil-7.txt AC 339 ms
49,988 KB
testcase-evil-8.txt AC 131 ms
50,064 KB
testcase-evil-9.txt AC 73 ms
49,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;

public class Main {

    void solve() throws IOException {
        int n = ni(), m = ni();

        int ans = 0;
        while (n != m) {
            ans++;
            if (n < m) {
                int tmp = n;
                n = m;
                m = tmp;
            } else {
                n -= m;
            }
        }

        out.println(ans);
    }

    int gcd(int a, int b) {
        return a == 0 ? b : gcd(b % a, a);
    }

    String ns() throws IOException {
        while (!tok.hasMoreTokens()) {
            tok = new StringTokenizer(in.readLine(), " ");
        }
        return tok.nextToken();
    }

    int ni() throws IOException {
        return Integer.parseInt(ns());
    }

    long nl() throws IOException {
        return Long.parseLong(ns());
    }

    double nd() throws IOException {
        return Double.parseDouble(ns());
    }

    String[] nsa(int n) throws IOException {
        String[] res = new String[n];
        for (int i = 0; i < n; i++) {
            res[i] = ns();
        }
        return res;
    }

    int[] nia(int n) throws IOException {
        int[] res = new int[n];
        for (int i = 0; i < n; i++) {
            res[i] = ni();
        }
        return res;
    }

    long[] nla(int n) throws IOException {
        long[] res = new long[n];
        for (int i = 0; i < n; i++) {
            res[i] = nl();
        }
        return res;
    }

    static BufferedReader in;
    static PrintWriter out;
    static StringTokenizer tok;

    public static void main(String[] args) throws IOException {
        in = new BufferedReader(new InputStreamReader(System.in));
        out = new PrintWriter(System.out);
        tok = new StringTokenizer("");
        Main main = new Main();
        main.solve();
        out.close();
    }
}
0