結果

問題 No.239 にゃんぱすー
ユーザー しらゆき
提出日時 2015-11-20 10:06:28
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 31 ms / 2,000 ms
コード長 885 bytes
コンパイル時間 785 ms
コンパイル使用メモリ 110,812 KB
実行使用メモリ 28,068 KB
最終ジャッジ日時 2024-09-13 17:05:21
合計ジャッジ時間 2,975 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
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.

ソースコード

diff #

using System;

class Program
{
    static void Main()
    {
        int n = int.Parse(Console.ReadLine());
        string[,] a = new string[n, n];

        for (int i = 0; i < n; i++)
        {
            string[] s = Console.ReadLine().Split();
            for (int j = 0; j < n; j++)
            {
                a[i, j] = s[j];
            }
        }

        int renchon = -1;
        int cnt = 0;

        for (int j = 0; j < n; j++)
        {
            for (int i = 0; i < n; i++)
            {
                if (a[i, j] == "nyanpass") cnt++;
            }

            if (cnt == n - 1)
            {
                if (renchon != -1)
                {
                    Console.WriteLine(-1);
                    return;
                }
                else renchon = j + 1;
            }

            cnt = 0;
        }

        Console.WriteLine(renchon);
    }
}
0