結果

問題 No.239 にゃんぱすー
ユーザー funakoshi
提出日時 2019-06-27 13:03:35
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 2,000 ms
コード長 1,353 bytes
コンパイル時間 2,812 ms
コンパイル使用メモリ 109,664 KB
実行使用メモリ 19,456 KB
最終ジャッジ日時 2024-06-27 16:04:42
合計ジャッジ時間 2,946 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.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace yukicoderTest
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            int n = int.Parse(input);
            int[] cnt = new int[n];
            for (int i = 0; i < n; i++)
            {
                string[] aisatu = Console.ReadLine().Split(' ');
                for (int j = 0; j < n; j++)
                {
                    if (aisatu[j] == "nyanpass")
                    {
                        cnt[j]++;
                    }
                }
            }
            int max = -100;
            int ren = -1;
            bool flg = false;
            for (int i = 0; i < n; i++)
            {
                if (cnt[i]==n-1&&flg==false)
                {
                    max = cnt[i];
                    ren = i;
                    flg = true;
                }
                else if (cnt[i] == max&&flg==true)
                {
                    ren = -1;
                    break;
                }
            }
            if (ren != -1)
            {
                Console.WriteLine(ren + 1);
            }
            else
            {
                Console.WriteLine(ren);
            }
        }

    }
}
0