結果

問題 No.1032 数数え
ユーザー bluemeganebluemegane
提出日時 2020-09-08 14:37:14
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 701 bytes
コンパイル時間 1,973 ms
コンパイル使用メモリ 65,208 KB
実行使用メモリ 44,380 KB
最終ジャッジ日時 2023-08-19 20:44:09
合計ジャッジ時間 3,305 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 59 ms
20,688 KB
testcase_01 AC 59 ms
20,648 KB
testcase_02 AC 61 ms
22,828 KB
testcase_03 AC 59 ms
22,748 KB
testcase_04 AC 59 ms
22,744 KB
testcase_05 AC 59 ms
22,764 KB
testcase_06 AC 59 ms
20,696 KB
testcase_07 AC 213 ms
44,380 KB
testcase_08 AC 59 ms
20,652 KB
testcase_09 AC 71 ms
18,836 KB
testcase_10 AC 68 ms
20,940 KB
testcase_11 AC 59 ms
20,708 KB
testcase_12 AC 206 ms
39,576 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System.Text;
using System;

public class Hello
{
    static void Main()
    {
        string[] line = Console.ReadLine().Trim().Split(' ');
        var n = int.Parse(line[0]);
        var m = int.Parse(line[1]);
        line = Console.ReadLine().Trim().Split(' ');
        var a = Array.ConvertAll(line, int.Parse);
        getAns(n, m, a);
    }
    static void getAns(int n, int m, int[] a)
    {
        var sb = new StringBuilder();
        var t = new int[m + 1];
        for (int i = 0; i < n; i++)
        {
            if (a[i] <= m) t[a[i]]++;
        }
        for (int i = 1; i <= m; i++)
            sb.Append(string.Format("{0} {1}\n", i, t[i]));
        Console.Write(sb);
    }
}
0