結果

問題 No.293 4>7の世界
ユーザー 14番14番
提出日時 2016-05-15 02:49:40
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 30 ms / 2,000 ms
コード長 2,111 bytes
コンパイル時間 6,567 ms
コンパイル使用メモリ 103,808 KB
実行使用メモリ 17,536 KB
最終ジャッジ日時 2024-12-30 12:02:23
合計ジャッジ時間 6,638 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Text;
using System.Linq;

class Program
{
    public void Proc()
    {
        Reader.IsDebug = false;
        string[] inpt = Reader.ReadLine().Split(' ');
        string num1 = inpt[0].TrimStart(new char[] { '0' });
        string num2 = inpt[1].TrimStart(new char[] { '0' });
        if (num1.Length == 0)
        {
            num1 = "0";
        }
        if (num2.Length == 0)
        {
            num2 = "0";
        }
        string ans = num1;
        if (num1.Length > num2.Length)
        {
            ans = num1;
        }
        else if (num2.Length > num1.Length)
        {
            ans = num2;
        }
        else
        {
            for (int i = 0; i < num1.Length; i++)
            {
                if (num1[i] == '7' && num2[i] == '4')
                {
                    ans = num2;
                    break;
                }
                else if (num1[i] == '4' && num2[i] == '7')
                {
                    ans = num1;
                    break;
                }
                else if (num1[i] > num2[i])
                {
                    ans = num1;
                    break;
                }
                else if (num1[i] < num2[i])
                {
                    ans = num2;
                    break;
                }
            }
        }
        Console.WriteLine(ans);
    }







    public class Reader
    {
        public static bool IsDebug = true;
        private static String PlainInput = @"
 

1237564890 1234567890



 
";
        private static System.IO.StringReader Sr = null;
        public static string ReadLine()
        {
            if (IsDebug)
            {
                if (Sr == null)
                {
                    Sr = new System.IO.StringReader(PlainInput.Trim());
                }
                return Sr.ReadLine();
            }
            else
            {
                return Console.ReadLine();
            }
        }

    }
    static void Main()
    {
        Program prg = new Program();
        prg.Proc();
    }
}
0