結果
問題 |
No.293 4>7の世界
|
ユーザー |
![]() |
提出日時 | 2015-11-23 22:17:55 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 139 ms / 2,000 ms |
コード長 | 1,234 bytes |
コンパイル時間 | 2,298 ms |
コンパイル使用メモリ | 74,240 KB |
実行使用メモリ | 41,256 KB |
最終ジャッジ日時 | 2024-12-30 11:34:30 |
合計ジャッジ時間 | 6,479 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
package com.company; import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String left = scanner.next(); String right = scanner.next(); if(left.length() < right.length()) { System.out.println(right); return; } if(left.length() > right.length()) { System.out.println(left); return; } for(int i = 0;i < left.length();i++) { char leftValue = left.charAt(i); char rightValue = right.charAt(i); if(leftValue == rightValue) { continue; } if(leftValue == '7' && rightValue == '4') { System.out.println(right); return; } if(leftValue == '4' && rightValue == '7') { System.out.println(left); return; } if(leftValue > rightValue) { System.out.println(left); return; } System.out.println(right); return; } } }