結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 121 ms
41,560 KB
testcase_01 AC 126 ms
41,340 KB
testcase_02 AC 120 ms
41,608 KB
testcase_03 WA -
testcase_04 AC 125 ms
41,232 KB
testcase_05 WA -
testcase_06 AC 122 ms
41,364 KB
testcase_07 AC 122 ms
41,248 KB
testcase_08 AC 129 ms
41,460 KB
testcase_09 WA -
testcase_10 AC 128 ms
41,268 KB
testcase_11 AC 124 ms
41,536 KB
testcase_12 AC 123 ms
41,472 KB
testcase_13 AC 121 ms
41,504 KB
testcase_14 AC 122 ms
41,388 KB
testcase_15 WA -
testcase_16 AC 124 ms
41,484 KB
testcase_17 AC 127 ms
41,208 KB
testcase_18 AC 126 ms
41,248 KB
testcase_19 AC 126 ms
41,108 KB
testcase_20 AC 128 ms
41,384 KB
testcase_21 AC 128 ms
41,432 KB
testcase_22 AC 127 ms
41,116 KB
testcase_23 AC 127 ms
41,208 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 A = "";
    String B = "";
    for(int i = 0; i < a.length(); i++) {
      char c = a.charAt(i);
      if(c == '4') A += "7";
      if(c == '7') A += "4";
      if(c != '4' && c != '7') A += String.valueOf(c);
    }
    for(int i = 0; i < b.length(); i++) {
      char c = b.charAt(i);
      if(c == '4') B += "7";
      if(c == '7') B += "4";
      if(c != '4' && c != '7') B += String.valueOf(c);
    }
    String ans = a;
    if(Long.parseLong(A) < Long.parseLong(B)) ans = b;
    System.out.println(ans);
  }
}
0