結果

問題 No.740 幻の木
ユーザー Maeda
提出日時 2025-04-08 16:42:01
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 70 ms / 2,000 ms
コード長 1,042 bytes
コンパイル時間 8,229 ms
コンパイル使用メモリ 169,772 KB
実行使用メモリ 187,108 KB
最終ジャッジ日時 2025-04-08 16:42:10
合計ジャッジ時間 9,358 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (108 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

    class Program
    {
        static void Main(string[] args)
        {
            string[] tree = Console.ReadLine().Split(' ');
            int maxLeaf = int.Parse(tree[0]);
            int decrease = int.Parse(tree[1]);
            int month = int.Parse(tree[2]);
            int count = 0;
            List<int> list = new List<int>();
            for(int i = 0; i < int.Parse(tree[3]); i++)
            {
                list.Add(month);
                month++;
                if(month == 13)
                {
                    month = 1;
                }
            }
            month = 1;
            while(maxLeaf > 0)
            {
                count++;
                if( list.IndexOf(month) == -1)
                {
                    maxLeaf -= decrease;
                }
                else
                {
                    maxLeaf -= decrease * 2;
                }
                month++;
                if(month == 13) { month = 1; }
            }
            Console.WriteLine(count);
        }
    }
0