結果
問題 | No.293 4>7の世界 |
ユーザー |
|
提出日時 | 2015-11-02 16:47:57 |
言語 | Scala(Beta) (3.6.2) |
結果 |
AC
|
実行時間 | 945 ms / 2,000 ms |
コード長 | 657 bytes |
コンパイル時間 | 9,965 ms |
コンパイル使用メモリ | 261,692 KB |
実行使用メモリ | 63,512 KB |
最終ジャッジ日時 | 2024-06-29 04:42:53 |
合計ジャッジ時間 | 34,030 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 20 |
ソースコード
object Yuki293 extends App{def compare(a :String, b:String) :String = {if(a.length > b.length) return aelse if (a.length < b.length) return bdef compareImpl(x :String, y:String, i:Int) :String = {if(i >= x.length) return xval xi = x.charAt(i).asDigitval yi = y.charAt(i).asDigitif(xi == 4 && yi == 7) xelse if(xi == 7 && yi == 4) yelse if(xi == yi) compareImpl(x, y, i + 1)else if(xi >= yi) xelse y}compareImpl(a, b, 0)}val input = new java.util.Scanner(System.in)val a = input.nextval b = input.nextval result = compare(a, b)println(result)}