結果
問題 |
No.239 にゃんぱすー
|
ユーザー |
|
提出日時 | 2022-06-07 15:20:56 |
言語 | C#(csc) (csc 3.9.0) |
結果 |
AC
|
実行時間 | 31 ms / 2,000 ms |
コード長 | 1,245 bytes |
コンパイル時間 | 834 ms |
コンパイル使用メモリ | 106,860 KB |
実行使用メモリ | 26,256 KB |
最終ジャッジ日時 | 2024-09-21 04:53:14 |
合計ジャッジ時間 | 2,898 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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; namespace yukicoder { class Program { static void Main(string[] args) { int a = int.Parse(Console.ReadLine()); string[,] b = new string[a,a]; int[] c = new int[a]; int d=0; int count = 0; int ans=0; for(int i = 0; i < a; i++) { string[] s = Console.ReadLine().Split(' '); for(int j = 0; j < a; j++) { b[i,j ] = s[j]; } } for (int i = 0; i < a; i++) { for (int j = 0; j < a; j++) { if(b[j, i]=="nyanpass") { count++; } } if(count == a-1&&d<1) { d++; ans = i+1; } else if(count == a-1&& d >= 1) { d++; } if (ans == 0 || d > 1) { ans = -1; } count = 0; } Console.WriteLine(ans); } } }