結果
| 問題 |
No.293 4>7の世界
|
| コンテスト | |
| ユーザー |
YamaKasa
|
| 提出日時 | 2018-09-09 23:30:50 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 151 ms / 2,000 ms |
| コード長 | 767 bytes |
| コンパイル時間 | 4,526 ms |
| コンパイル使用メモリ | 76,756 KB |
| 実行使用メモリ | 41,640 KB |
| 最終ジャッジ日時 | 2024-12-30 12:42:42 |
| 合計ジャッジ時間 | 6,996 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 20 |
ソースコード
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
String A = scan.next();
String B = scan.next();
scan.close();
int l1 = A.length();
int l2 = B.length();
if(l1 > l2) {
System.out.println(A);
}else if(l1 < l2) {
System.out.println(B);
}else {
for(int i = 0; i < l1; i++) {
char c1 = A.charAt(i);
char c2 = B.charAt(i);
if(c1 == '4' && c2 == '7') {
System.out.println(A);
System.exit(0);
}else if(c1 == '7' && c2 == '4') {
System.out.println(B);
System.exit(0);
}else if(c1 > c2) {
System.out.println(A);
System.exit(0);
}else if(c1 < c2) {
System.out.println(B);
System.exit(0);
}
}
}
}
}
YamaKasa