結果
問題 | No.29 パワーアップ |
ユーザー |
|
提出日時 | 2020-06-22 16:35:30 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 33 ms / 5,000 ms |
コード長 | 923 bytes |
コンパイル時間 | 859 ms |
コンパイル使用メモリ | 114,448 KB |
実行使用メモリ | 27,524 KB |
最終ジャッジ日時 | 2024-07-03 18:42:00 |
合計ジャッジ時間 | 2,400 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 22 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Linq; using System.Collections.Generic; namespace _0029 { class Program { static void Main(string[] args) { var n = int.Parse(Console.ReadLine()); var d = new Dictionary<int,int>(); var p = 0; for(var i = 0; i < n; i++){ var t = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray(); for(var j = 0; j < 3; j++){ var m = t[j]; if(d.ContainsKey(m)){ d[m] += 1; if(d[m] == 2){ p += 1; d[m] = 0; } }else{ d.Add(m,1); } } } var s = d.Sum(x => x.Value); Console.WriteLine(s / 4 + p); } } }