結果

問題 No.39 桁の数字を入れ替え
ユーザー AreTrashAreTrash
提出日時 2016-04-16 15:17:44
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 533 bytes
コンパイル時間 809 ms
コンパイル使用メモリ 112,636 KB
実行使用メモリ 28,476 KB
最終ジャッジ日時 2024-04-15 02:10:57
合計ジャッジ時間 2,054 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 23 ms
24,460 KB
testcase_01 AC 25 ms
24,588 KB
testcase_02 AC 23 ms
26,168 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 24 ms
24,392 KB
testcase_08 AC 24 ms
24,324 KB
testcase_09 AC 24 ms
26,176 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 22 ms
24,124 KB
testcase_15 AC 22 ms
24,204 KB
testcase_16 AC 24 ms
26,440 KB
testcase_17 AC 23 ms
24,336 KB
testcase_18 AC 22 ms
22,452 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.Linq;

namespace No39_1{
    public class Program{
        public static void Main(string[] args){
            var n = Console.ReadLine().ToCharArray();
            var length = n.Length;
            var max = n.Max();

            var tmp = n[0];
            for(var i = length - 1; i > 0; i--){
                if(n[i] == max){
                    n[0] = n[i];
                    n[i] = tmp;
                    break;
                }
            }

            Console.WriteLine(n);
        }
    }
}
0