結果

問題 No.293 4>7の世界
ユーザー bayashiko_rbayashiko_r
提出日時 2019-08-08 00:03:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 62 ms / 2,000 ms
コード長 1,563 bytes
コンパイル時間 2,302 ms
コンパイル使用メモリ 104,348 KB
実行使用メモリ 23,076 KB
最終ジャッジ日時 2023-09-25 23:20:03
合計ジャッジ時間 5,199 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
21,044 KB
testcase_01 AC 58 ms
23,040 KB
testcase_02 AC 58 ms
21,088 KB
testcase_03 AC 59 ms
21,016 KB
testcase_04 AC 58 ms
20,988 KB
testcase_05 AC 60 ms
20,932 KB
testcase_06 AC 60 ms
21,196 KB
testcase_07 AC 60 ms
21,068 KB
testcase_08 AC 59 ms
19,100 KB
testcase_09 AC 58 ms
21,068 KB
testcase_10 AC 58 ms
21,124 KB
testcase_11 AC 59 ms
21,084 KB
testcase_12 AC 58 ms
23,056 KB
testcase_13 AC 58 ms
23,076 KB
testcase_14 AC 58 ms
21,096 KB
testcase_15 AC 58 ms
20,996 KB
testcase_16 AC 59 ms
18,952 KB
testcase_17 AC 58 ms
20,852 KB
testcase_18 AC 59 ms
21,072 KB
testcase_19 AC 60 ms
18,924 KB
testcase_20 AC 62 ms
21,024 KB
testcase_21 AC 59 ms
23,032 KB
testcase_22 AC 59 ms
22,880 KB
testcase_23 AC 58 ms
23,068 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;
using System.Text;
using System.Threading.Tasks;

class Program {
    static void Main(string[] args) {
        string s = Console.ReadLine();
        int A = int.Parse(s.Split(' ')[0]);
        int B = int.Parse(s.Split(' ')[1]);

        //Aの桁数
        int keta_A = (int)Math.Floor(Math.Log10(A)) + 1;
        //Bの桁数
        int keta_B = (int)Math.Floor(Math.Log10(B)) + 1;

        //Console.WriteLine(A.ToString()[0]);
        //Console.WriteLine(B.ToString()[0]);

        //桁が異なるとき
        if (keta_A > keta_B) {
            Console.WriteLine(A);
        } else if (keta_A < keta_B) {
            Console.WriteLine(B);
        //以下、桁が同じとき
        } else {
            for (int i = 0; i < keta_A; i++) {
                if ((A.ToString()[i] == '4' && B.ToString()[i] == '7')) {
                    //Console.WriteLine("1");
                    Console.WriteLine(A);
                    break;
                } else if (A.ToString()[i] == '7' && B.ToString()[i] == '4') {
                    //Console.WriteLine("2");
                    Console.WriteLine(B);
                    break;
                } else if (A.ToString()[i] == B.ToString()[i]) {
                    //Console.WriteLine("3");
                    //次のループに入る
                } else {
                    //Console.WriteLine("4");
                    Console.WriteLine(Math.Max(A, B));
                    break;
                }
            }
        }
    }
}
0