結果

問題 No.201 yukicoderじゃんけん
ユーザー Pump0129Pump0129
提出日時 2018-03-28 00:35:54
言語 Java21
(openjdk 21)
結果
AC  
実行時間 171 ms / 5,000 ms
コード長 1,484 bytes
コンパイル時間 2,239 ms
コンパイル使用メモリ 73,976 KB
実行使用メモリ 58,368 KB
最終ジャッジ日時 2023-09-07 19:16:06
合計ジャッジ時間 5,769 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 109 ms
57,676 KB
testcase_01 AC 108 ms
55,884 KB
testcase_02 AC 110 ms
55,716 KB
testcase_03 AC 115 ms
55,824 KB
testcase_04 AC 117 ms
55,988 KB
testcase_05 AC 119 ms
56,208 KB
testcase_06 AC 116 ms
56,064 KB
testcase_07 AC 118 ms
55,684 KB
testcase_08 AC 123 ms
55,992 KB
testcase_09 AC 120 ms
56,108 KB
testcase_10 AC 119 ms
55,800 KB
testcase_11 AC 119 ms
55,528 KB
testcase_12 AC 125 ms
55,984 KB
testcase_13 AC 119 ms
55,936 KB
testcase_14 AC 113 ms
55,740 KB
testcase_15 AC 157 ms
56,036 KB
testcase_16 AC 145 ms
56,008 KB
testcase_17 AC 147 ms
55,692 KB
testcase_18 AC 170 ms
58,368 KB
testcase_19 AC 171 ms
57,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package net.ipipip0129.yukicoder.no201;

import java.util.Scanner;

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

        String[] data = scan.nextLine().split(" ");
        String p1_name = data[0];
        String p1_point = data[1];

        data = scan.nextLine().split(" ");
        String p2_name = data[0];
        String p2_point = data[1];

        scan.close();

        int result = -1;

        if (p1_point.length() == p2_point.length()) {
            for (int i = 0; i < p1_point.length(); i++) {
                if (Integer.parseInt(String.valueOf(p1_point.charAt(i))) < Integer.parseInt(String.valueOf(p2_point.charAt(i)))) {
                    result = 1;
                    break;
                } else if (Integer.parseInt(String.valueOf(p1_point.charAt(i))) > Integer.parseInt(String.valueOf(p2_point.charAt(i)))) {
                    result = 0;
                    break;
                }
            }
        } else if(p1_point.length() < p2_point.length()) {
            result = 1;
        } else {
            result = 0;
        }

        switch (result) {
            case -1:
                System.out.println(-1);
                break;
            case 0:
                System.out.println(p1_name);
                break;
            case 1:
                System.out.println(p2_name);
                break;
        }
    }
}
0