結果

問題 No.239 にゃんぱすー
ユーザー TD
提出日時 2022-06-07 11:44:16
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,243 bytes
コンパイル時間 811 ms
コンパイル使用メモリ 102,912 KB
実行使用メモリ 19,584 KB
最終ジャッジ日時 2024-09-21 04:52:18
合計ジャッジ時間 2,781 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 29 WA * 4
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = int.Parse(Console.ReadLine());
            int[] b = new int[a];
            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++)
                {
                    if(s[j]== "nyanpass")
                    {
                        b[j]++;
                    }
                }
            }
            for (int x = 0; x <a; x++)
            {
                if (ans != 0)
                {
                    if (b[x] > b[ans - 1])
                    {
                        ans = x + 1;
                    }
                    else if (b[x] == b[ans - 1])
                    {
                        count++;
                    }

                }
                else
                {
                    if (b[x] != 0)
                    {
                        ans = x + 1;
                    }
                }
 

            }
            if (ans == 0 || count > 1)
                ans = -1;
            Console.WriteLine(ans);
        }
    }
}
0