結果

問題 No.1628 Sorting Integers (MAX of M)
ユーザー monpemonpe
提出日時 2021-10-25 10:53:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 38 ms / 2,000 ms
コード長 751 bytes
コンパイル時間 1,926 ms
コンパイル使用メモリ 115,192 KB
実行使用メモリ 27,980 KB
最終ジャッジ日時 2024-04-14 04:51:15
合計ジャッジ時間 3,130 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
25,804 KB
testcase_01 AC 37 ms
25,764 KB
testcase_02 AC 32 ms
25,124 KB
testcase_03 AC 37 ms
25,888 KB
testcase_04 AC 33 ms
27,180 KB
testcase_05 AC 37 ms
27,968 KB
testcase_06 AC 36 ms
24,124 KB
testcase_07 AC 37 ms
27,980 KB
testcase_08 AC 38 ms
26,196 KB
testcase_09 AC 37 ms
25,924 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;

class Program
{
    static void Main()
    {
        int N = int.Parse(Console.ReadLine());
        var num = Console.ReadLine().Split(' ').ToArray();

        string s = "123456789";

        var ans = new List<string>();
        for(int i = 0; i < 9; i++)
        {
            if (num[i] == "0") continue;
            else
            {
                ans.Add(new string(s[i], Convert.ToInt32(num[i])));
            }
        }

        ans.Sort();
        ans.Reverse();

        foreach(var n in ans)
        {
            Console.Write(n);
        }
        Console.WriteLine();
    }
}
0