結果

問題 No.1644 Eight Digits
ユーザー nakamura0422nakamura0422
提出日時 2023-01-12 10:39:11
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 898 ms / 1,000 ms
コード長 909 bytes
コンパイル時間 7,983 ms
コンパイル使用メモリ 166,324 KB
実行使用メモリ 208,436 KB
最終ジャッジ日時 2024-05-03 23:45:03
合計ジャッジ時間 34,718 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 881 ms
54,656 KB
testcase_01 AC 879 ms
54,784 KB
testcase_02 AC 880 ms
54,656 KB
testcase_03 AC 894 ms
54,656 KB
testcase_04 AC 885 ms
54,632 KB
testcase_05 AC 889 ms
54,656 KB
testcase_06 AC 896 ms
54,784 KB
testcase_07 AC 880 ms
54,656 KB
testcase_08 AC 886 ms
54,636 KB
testcase_09 AC 876 ms
54,784 KB
testcase_10 AC 883 ms
54,760 KB
testcase_11 AC 884 ms
54,784 KB
testcase_12 AC 898 ms
54,756 KB
testcase_13 AC 884 ms
54,528 KB
testcase_14 AC 879 ms
54,528 KB
testcase_15 AC 883 ms
54,784 KB
testcase_16 AC 884 ms
54,656 KB
testcase_17 AC 877 ms
54,656 KB
testcase_18 AC 885 ms
54,756 KB
testcase_19 AC 894 ms
54,912 KB
testcase_20 AC 887 ms
54,764 KB
testcase_21 AC 878 ms
54,784 KB
testcase_22 AC 884 ms
54,784 KB
testcase_23 AC 888 ms
54,912 KB
testcase_24 AC 892 ms
54,636 KB
testcase_25 AC 885 ms
54,784 KB
testcase_26 AC 888 ms
54,656 KB
testcase_27 AC 879 ms
208,436 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (96 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;
using System.Collections.Generic;
using System.Linq;
static class EightDigits
{
    static void Main()
    {
        var K = int.Parse(Console.ReadLine().Trim());
        var ans = Enumerate(Enumerable.Range(1, 8))
                            .Select(x => int.Parse(string.Join("", x)))
                            .Where(y => y % K == 0)
                            .Count();

        Console.WriteLine(ans);
    }
    static IEnumerable<T[]> Enumerate<T>(IEnumerable<T> items)
    {
        if (items.Count() == 1)
        {
            yield return new T[] { items.First() };
            yield break;
        }
        foreach (var item in items)
        {
            var leftside = new T[] { item };
            var unused = items.Except(leftside);
            foreach (var rightside in Enumerate(unused))
                yield return leftside.Concat(rightside).ToArray();
        }
    }
}
0