結果
問題 | No.29 パワーアップ |
ユーザー |
|
提出日時 | 2020-04-29 15:12:59 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 33 ms / 5,000 ms |
コード長 | 716 bytes |
コンパイル時間 | 1,091 ms |
コンパイル使用メモリ | 113,180 KB |
実行使用メモリ | 27,316 KB |
最終ジャッジ日時 | 2024-11-28 16:09:41 |
合計ジャッジ時間 | 2,683 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; class Program { static void Main() { int n = int.Parse(Console.ReadLine()); int[] list = new int[n * 3]; for(int i = 0; i < n; i++) { int[] num = Console.ReadLine().Split().Select(a => int.Parse(a)).ToArray(); for(int j = 0; j < 3; j++) { list[i * 3 + j] = num[j]; } } Array.Sort(list); int pair = 0; for(int i = 1; i < list.Length; i++) { if(list[i - 1] == list[i]) { pair++; i++; } } Console.WriteLine($"{pair + (list.Length - pair * 2) / 4}"); } }