結果
| 問題 | No.293 4>7の世界 | 
| コンテスト | |
| ユーザー |  mban | 
| 提出日時 | 2016-12-23 13:45:10 | 
| 言語 | C#(csc) (csc 3.9.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 27 ms / 2,000 ms | 
| コード長 | 1,437 bytes | 
| コンパイル時間 | 1,141 ms | 
| コンパイル使用メモリ | 103,680 KB | 
| 実行使用メモリ | 17,664 KB | 
| 最終ジャッジ日時 | 2024-12-30 12:20:31 | 
| 合計ジャッジ時間 | 2,854 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| 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.
ソースコード
using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.Linq;
class Magatro
{
    static void Main()
    {
        string[] AB = Console.ReadLine().Split(' ');
        if (Compare(AB[0], AB[1])==1)
        {
            Console.WriteLine(AB[0]);
        }
        else
        {
            Console.WriteLine(AB[1]);
        }
    }
    static int Compare(string A,string B)
    {
        if (A.Length > B.Length)
        {
            return 1;
        }
        else if (A.Length < B.Length)
        {
            return -1;
        }
        for(int i = 0; i < A.Length; i++)
        {
            if (Com(A[i], B[i]) == 1)
            {
                return 1;
            }
            else if (Com(A[i], B[i]) == -1)
            {
                return -1;
            }
            
        }
        return 0;
    }
    static int Com(char a,char b)
    {
        if (a == '4' && b == '7')
        {
            return 1;
        }
        else if (a == '7' && b == '4')
        {
            return -1;
                }
        else
        {
            if (a > b)
            {
                return 1;
                }
            else if(a<b)
            {
                return -1;
            }
            else
            {
                return 0;
            }
        }
    }
  
}
            
            
            
        