結果

問題 No.314 ケンケンパ
コンテスト
ユーザー aaa aa
提出日時 2025-12-11 09:26:30
言語 C#
(.NET 8.0.404)
結果
MLE  
実行時間 -
コード長 1,500 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 17,109 ms
コンパイル使用メモリ 171,264 KB
実行使用メモリ 653,152 KB
最終ジャッジ日時 2025-12-11 09:26:55
合計ジャッジ時間 22,997 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample -- * 3
other MLE * 1 -- * 16
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (104 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #
raw source code

using System.Numerics;

public class Program
{
    public static void Main()
    {

        //BigInteger num = BigInteger.Parse(Console.ReadLine() ?? string.Empty);
        int num = int.Parse(Console.ReadLine() ?? string.Empty);
        //string[] moji = (Console.ReadLine() ?? string.Empty).Trim().Split(' ');
        //string str = Console.ReadLine() ?? string.Empty;

        
        List<string> list = new List<string>();


        KENPA(list, "", 0,num,0);
        double d = Math.Pow(10, 9);
        int aa = (int)(list.Count % (d + 7));
        Console.WriteLine(aa); 
        
    }
    static void KENPA(List<string> list, string box, int index,int num,int youso)
    {
        if(youso ==num)
        {
            list.Add(box);
            return;
        }
        string[] strings = { "ケン", "パ"};

        for(int i = 0; i < strings.Length; i++)
        {
            
            int yy = youso;
            string a = box;
            if(a==""&&i ==1)
            {
                return;
            }
            if(a!="")
            {
                if(a[a.Length - 1] == 'パ' && i == 1)
                {
                    continue;
                }
                if(a.Length >=4)
                {
                    if (a.Substring(a.Length - 4) == "ケンケン" && i == 0)
                    {
                        continue;
                    }
                }
            }
            KENPA(list, a + strings[i], i, num, yy+1);
        }

    }
}
0