結果

問題 No.418 ミンミンゼミ
ユーザー fujita
提出日時 2023-05-09 15:13:25
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 46 ms / 1,000 ms
コード長 1,261 bytes
コンパイル時間 8,039 ms
コンパイル使用メモリ 164,840 KB
実行使用メモリ 180,168 KB
最終ジャッジ日時 2024-11-26 01:58:13
合計ジャッジ時間 10,395 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (95 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

using System;

namespace yukicoder
{
    class Program
    {

        static void Main(string[] args)
        {
            var S = Console.ReadLine();
            
            string[] strings = new string[S.Length] ;
            int Mcnt = 0, Icnt = 0, Ncnt = 0 , anscnt = 0;
            
            for(int i = 0; i < S.Length ; i++)
            {
                strings[i] = S.Substring(i , 1);
            }
            
            for(int j  = 0; j < strings.Length ; j++)
            {
                if (strings[j] == "m")
                {
                    Mcnt++;
                }
                else if (strings[j] == "i")
                {
                    Icnt++;
                }
                else if (strings[j] == "n")
                {
                    Ncnt++;
                }
            }
            for(int x = 0; x < strings.Length; x++)
            {
                if (Mcnt > 0 && Icnt > 0 && Ncnt > 0)
                {
                    anscnt++;
                    Mcnt--;
                    Icnt--;
                    Ncnt--;
                }
                else
                {
                    Console.WriteLine(anscnt);
                    break;
                }
            }
        }
    }
}
0