結果

問題 No.1934 Four Fruits
ユーザー mobchan
提出日時 2023-04-23 13:12:20
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 58 ms / 2,000 ms
コード長 889 bytes
コンパイル時間 10,040 ms
コンパイル使用メモリ 166,940 KB
実行使用メモリ 182,416 KB
最終ジャッジ日時 2024-11-07 20:28:25
合計ジャッジ時間 11,338 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (94 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;

class Program
{
    static void Main(string[] args)
    {
        var input = Console.ReadLine().Split().Select(int.Parse).ToArray();

        var dic = new Dictionary<int, int> { { 0, 0 }, { 1, 0 }, { 2, 0 }, { 3, 0 } };
        foreach (var item in input) dic[item]++;

        if (dic.ContainsValue(3))
        {
            foreach (var item in dic)
            {
                if (item.Value == 3) Console.WriteLine(item.Key);
            }
        }
        else if (dic.ContainsValue(2))
        {
            foreach (var item in dic)
            {
                if (item.Value == 1) Console.WriteLine(item.Key);
            }
        }
        else
        {
            foreach (var item in dic)
            {
                if (item.Value == 0) Console.WriteLine(item.Key);
            }
        }
    }
}
0