結果

問題 No.293 4>7の世界
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-09 19:15:00
言語 Java19
(openjdk 21)
結果
AC  
実行時間 127 ms / 2,000 ms
コード長 867 bytes
コンパイル時間 2,136 ms
コンパイル使用メモリ 71,632 KB
実行使用メモリ 56,088 KB
最終ジャッジ日時 2023-08-28 22:21:15
合計ジャッジ時間 6,418 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
56,088 KB
testcase_01 AC 121 ms
55,800 KB
testcase_02 AC 120 ms
55,780 KB
testcase_03 AC 121 ms
55,804 KB
testcase_04 AC 123 ms
55,620 KB
testcase_05 AC 123 ms
55,620 KB
testcase_06 AC 125 ms
55,660 KB
testcase_07 AC 125 ms
55,428 KB
testcase_08 AC 127 ms
55,776 KB
testcase_09 AC 124 ms
55,700 KB
testcase_10 AC 123 ms
55,412 KB
testcase_11 AC 123 ms
55,704 KB
testcase_12 AC 124 ms
55,736 KB
testcase_13 AC 123 ms
55,564 KB
testcase_14 AC 122 ms
55,916 KB
testcase_15 AC 123 ms
55,904 KB
testcase_16 AC 121 ms
55,904 KB
testcase_17 AC 125 ms
53,604 KB
testcase_18 AC 124 ms
55,948 KB
testcase_19 AC 124 ms
53,608 KB
testcase_20 AC 120 ms
55,736 KB
testcase_21 AC 117 ms
55,712 KB
testcase_22 AC 118 ms
55,740 KB
testcase_23 AC 118 ms
55,464 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

public class Main {
  public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    String a = sc.next();
    String b = sc.next();
    String ans = "";
    if(a.length() > b.length()) {
      ans = a;
    } else if(a.length() < b.length()) {
      ans = b;
    } else {
      for(int i = 0; i < a.length(); i++) {
        int num1 = Integer.parseInt(String.valueOf(a.charAt(i)));
        int num2 = Integer.parseInt(String.valueOf(b.charAt(i)));
        if(num1 > num2) {
          if(num1 == 7 && num2 == 4) {
            ans = b;
          } else {
            ans = a;
          }
          break;
        } else if(num1 < num2) {
          if(num1 == 4 && num2 == 7) {
            ans = a;
          } else {
            ans = b;
          }
          break;
        }
      }
    }
    System.out.println(ans);
  }
}
0