結果
問題 | No.182 新規性の虜 |
ユーザー | yuki2006 |
提出日時 | 2018-01-15 14:47:57 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,481 bytes |
コンパイル時間 | 1,971 ms |
コンパイル使用メモリ | 98,388 KB |
実行使用メモリ | 29,692 KB |
最終ジャッジ日時 | 2023-08-25 17:14:10 |
合計ジャッジ時間 | 5,759 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 58 ms
20,748 KB |
testcase_01 | AC | 58 ms
22,676 KB |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 56 ms
20,796 KB |
testcase_16 | AC | 57 ms
18,676 KB |
testcase_17 | WA | - |
testcase_18 | AC | 104 ms
25,620 KB |
testcase_19 | AC | 92 ms
22,428 KB |
testcase_20 | AC | 82 ms
23,660 KB |
testcase_21 | AC | 111 ms
28,012 KB |
testcase_22 | AC | 85 ms
22,628 KB |
testcase_23 | AC | 56 ms
20,700 KB |
testcase_24 | WA | - |
testcase_25 | AC | 100 ms
25,316 KB |
testcase_26 | WA | - |
testcase_27 | WA | - |
evil01.txt | WA | - |
evil02.txt | WA | - |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
using System; using System.Collections.Generic; namespace lecture { class MainClass { public static void Main(string[] args) { string row = Console.ReadLine(); int N = int.Parse(row); row = Console.ReadLine(); // 空白区切りで一旦文字列の配列に区切る string[] tmp = row.Split(); // 文字列の配列に区切ったあとに1つずつそれぞれ数値の配列に変換する int[] A = new int[N]; for (int i = 0; i < N; i++) { A[i] = int.Parse(tmp[i]); } Array.Sort(A); int ans = 0; for (int i = 1; i < N - 1; i++) { if (!(A[i] == A[i - 1] || A[i] == A[i + 1])) { ans++; } } if (N == 1) { ans = 1; } else if (N > 1) { // 左端でみたときにとなりが違っていたら if (A[0] != A[1]) { ans++; } } else if (N > 2) { // 右端でみたときにとなりが違っていたら if (A[N - 1] != A[N - 2]) { ans++; } } Console.WriteLine(ans); } } }