結果

問題 No.239 にゃんぱすー
ユーザー funakoshi
提出日時 2019-06-27 11:13:31
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,375 bytes
コンパイル時間 806 ms
コンパイル使用メモリ 104,356 KB
実行使用メモリ 19,328 KB
最終ジャッジ日時 2024-06-27 13:58:14
合計ジャッジ時間 3,428 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 31 WA * 2
権限があれば一括ダウンロードができます
コンパイルメッセージ
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++)
            {
                cnt[i] = 0;
            }
            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 ren = 0;
            int max = 0;
            bool flg = false;
            for (int i=0;i<n;i++)
            {
                if(cnt[i]>max)
                {
                    max = cnt[i];
                    ren = i;
                    flg = true;
                }
                else if(cnt[i]==max)
                {
                    flg = false;
                }
            }
            if (flg == true)
            {
                Console.WriteLine(ren+1);
            }
            else
            {
                Console.WriteLine("-1");
            }
        }

    }
}
0