結果
問題 |
No.293 4>7の世界
|
ユーザー |
![]() |
提出日時 | 2019-08-08 00:03:50 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 27 ms / 2,000 ms |
コード長 | 1,563 bytes |
コンパイル時間 | 4,186 ms |
コンパイル使用メモリ | 112,176 KB |
実行使用メモリ | 18,432 KB |
最終ジャッジ日時 | 2024-07-18 18:54:10 |
合計ジャッジ時間 | 4,641 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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.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; } } } } }