結果
問題 | No.239 にゃんぱすー |
ユーザー |
|
提出日時 | 2019-01-25 14:15:52 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 33 ms / 2,000 ms |
コード長 | 954 bytes |
コンパイル時間 | 831 ms |
コンパイル使用メモリ | 105,728 KB |
実行使用メモリ | 21,248 KB |
最終ジャッジ日時 | 2024-09-16 04:46:36 |
合計ジャッジ時間 | 3,105 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 33 |
コンパイルメッセージ
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;using System.Linq;public static class Program{const string NYANPASS = "nyanpass";static void Main(string[] args){int N = int.Parse(Console.ReadLine());var matrix = new string[N, N];// 行列生成string[] line;for (int i=0; i<N; i++){line = Console.ReadLine().Split(' ');for (int j=0; j<N; j++){matrix[i,j] = line[j];}}// 検知var set = new HashSet<int>();int counter = 0;for (int i = 0; i < N; i++){counter = 0;for (int j = 0; j < N; j++){if (matrix[j, i] == NYANPASS) counter++;}if (counter == N - 1) set.Add(i);}Console.WriteLine( (set.Count() == 1 ) ? set.First() + 1 : -1);}} // class Program