結果

問題 No.293 4>7の世界
ユーザー takeya_okinotakeya_okino
提出日時 2017-07-09 19:14:15
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 833 bytes
コンパイル時間 2,211 ms
コンパイル使用メモリ 75,352 KB
実行使用メモリ 41,728 KB
最終ジャッジ日時 2024-04-16 11:14:27
合計ジャッジ時間 6,167 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 122 ms
41,216 KB
testcase_01 AC 124 ms
41,080 KB
testcase_02 AC 129 ms
41,192 KB
testcase_03 WA -
testcase_04 AC 128 ms
41,408 KB
testcase_05 AC 125 ms
41,484 KB
testcase_06 AC 126 ms
41,320 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 127 ms
41,228 KB
testcase_11 AC 124 ms
41,384 KB
testcase_12 AC 123 ms
41,328 KB
testcase_13 WA -
testcase_14 AC 124 ms
41,316 KB
testcase_15 WA -
testcase_16 AC 125 ms
41,412 KB
testcase_17 AC 124 ms
41,728 KB
testcase_18 AC 125 ms
41,200 KB
testcase_19 AC 115 ms
40,796 KB
testcase_20 AC 124 ms
41,080 KB
testcase_21 AC 126 ms
41,088 KB
testcase_22 AC 125 ms
41,336 KB
testcase_23 WA -
権限があれば一括ダウンロードができます

ソースコード

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;
          }
        } else if(num1 < num2) {
          if(num1 == 4 && num2 == 7) {
            ans = a;
          } else {
            ans = b;
          }
        }
      }
    }
    System.out.println(ans);
  }
}
0