結果

問題 No.293 4>7の世界
ユーザー noriocnorioc
提出日時 2016-09-22 15:41:07
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 1,220 bytes
コンパイル時間 3,360 ms
コンパイル使用メモリ 104,212 KB
実行使用メモリ 23,344 KB
最終ジャッジ日時 2023-08-28 22:13:41
合計ジャッジ時間 5,743 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 56 ms
21,204 KB
testcase_01 AC 55 ms
21,360 KB
testcase_02 AC 56 ms
21,304 KB
testcase_03 AC 52 ms
21,212 KB
testcase_04 AC 53 ms
21,316 KB
testcase_05 AC 52 ms
21,208 KB
testcase_06 AC 56 ms
23,252 KB
testcase_07 AC 52 ms
19,124 KB
testcase_08 AC 52 ms
21,276 KB
testcase_09 AC 53 ms
21,308 KB
testcase_10 AC 56 ms
21,312 KB
testcase_11 AC 53 ms
21,336 KB
testcase_12 AC 52 ms
21,264 KB
testcase_13 AC 53 ms
23,256 KB
testcase_14 AC 52 ms
19,272 KB
testcase_15 AC 53 ms
21,368 KB
testcase_16 AC 56 ms
23,344 KB
testcase_17 AC 52 ms
19,292 KB
testcase_18 AC 52 ms
21,236 KB
testcase_19 AC 53 ms
23,284 KB
testcase_20 AC 54 ms
21,356 KB
testcase_21 AC 56 ms
23,200 KB
testcase_22 AC 52 ms
21,200 KB
testcase_23 AC 53 ms
21,428 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class Program {
    static int ReadInt() { return int.Parse(Console.ReadLine()); }
    static int[] ReadInts() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    static string[] ReadStrings() { return Console.ReadLine().Split(); }

    static void Calc(string a, string b) {
        if (a.Length == b.Length) {
            for (int i = 0; i < a.Length; i++) {
                int x = a[i] - '0';
                int y = b[i] - '0';
                if (x == 4 && y == 7) {
                    Console.WriteLine(a);
                    return;
                }
                else if (x == 7 && y == 4) {
                    Console.WriteLine(b);
                    return;
                }
                else if (x != y) {
                    Console.WriteLine(x < y ? b : a);
                    return;
                }
            }
            // a == b
            Console.WriteLine(a);
        }
        else {
            var x = new[] { a, b }.OrderBy(e => e.Length).Last();
            Console.WriteLine(x);
        }
    }

    static void Main() {
        var ab = ReadStrings();
        Calc(ab[0], ab[1]);
    }
}
0