結果
問題 | No.182 新規性の虜 |
ユーザー |
![]() |
提出日時 | 2015-11-19 09:06:11 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 100 ms / 5,000 ms |
コード長 | 606 bytes |
コンパイル時間 | 4,577 ms |
コンパイル使用メモリ | 109,576 KB |
実行使用メモリ | 27,136 KB |
最終ジャッジ日時 | 2024-12-26 20:04:34 |
合計ジャッジ時間 | 5,614 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 27 |
コンパイルメッセージ
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[] a = Console.ReadLine().Split().Select(int.Parse).ToArray(); Array.Sort(a); int cnt = 0; for (int i = 0; i < n - 2; i++) { if (a[i] != a[i + 1] && a[i + 1] != a[i + 2]) { cnt++; } } if (n != 1) { if (a[0] != a[1]) cnt++; if (a[n - 2] != a[n - 1]) cnt++; } else cnt++; Console.WriteLine(cnt); } }