結果

問題 No.1644 Eight Digits
ユーザー nakamura0422nakamura0422
提出日時 2023-01-12 10:39:11
言語 C#
(.NET 8.0.203)
結果
AC  
実行時間 633 ms / 1,000 ms
コード長 909 bytes
コンパイル時間 18,384 ms
コンパイル使用メモリ 146,544 KB
実行使用メモリ 188,096 KB
最終ジャッジ日時 2023-08-24 19:06:31
合計ジャッジ時間 31,960 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 628 ms
54,976 KB
testcase_01 AC 627 ms
55,012 KB
testcase_02 AC 628 ms
56,788 KB
testcase_03 AC 624 ms
54,724 KB
testcase_04 AC 627 ms
54,764 KB
testcase_05 AC 627 ms
54,896 KB
testcase_06 AC 631 ms
54,712 KB
testcase_07 AC 629 ms
54,964 KB
testcase_08 AC 624 ms
55,032 KB
testcase_09 AC 622 ms
54,836 KB
testcase_10 AC 625 ms
55,048 KB
testcase_11 AC 622 ms
54,748 KB
testcase_12 AC 633 ms
54,752 KB
testcase_13 AC 620 ms
55,164 KB
testcase_14 AC 624 ms
53,168 KB
testcase_15 AC 625 ms
56,864 KB
testcase_16 AC 625 ms
54,872 KB
testcase_17 AC 626 ms
52,736 KB
testcase_18 AC 618 ms
54,772 KB
testcase_19 AC 632 ms
55,144 KB
testcase_20 AC 631 ms
54,992 KB
testcase_21 AC 625 ms
54,908 KB
testcase_22 AC 625 ms
54,884 KB
testcase_23 AC 625 ms
55,076 KB
testcase_24 AC 622 ms
54,756 KB
testcase_25 AC 626 ms
54,700 KB
testcase_26 AC 621 ms
55,008 KB
testcase_27 AC 622 ms
188,096 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
  Determining projects to restore...
  Restored /home/judge/data/code/main.csproj (in 138 ms).
.NET 向け Microsoft (R) Build Engine バージョン 17.0.0-preview-21470-01+cb055d28f
Copyright (C) Microsoft Corporation.All rights reserved.

  プレビュー版の .NET を使用しています。https://aka.ms/dotnet-core-preview をご覧ください
  main -> /home/judge/data/code/bin/Release/net6.0/main.dll
  main -> /home/judge/data/code/bin/Release/net6.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