結果

問題 No.189 SUPER HAPPY DAY
ユーザー 紙ぺーぱー紙ぺーぱー
提出日時 2015-04-18 03:05:44
言語 C#(csc)
(csc 3.9.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,410 bytes
コンパイル時間 2,961 ms
コンパイル使用メモリ 108,000 KB
実行使用メモリ 30,024 KB
最終ジャッジ日時 2023-09-17 22:32:32
合計ジャッジ時間 9,500 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
21,940 KB
testcase_01 AC 721 ms
28,032 KB
testcase_02 AC 70 ms
21,840 KB
testcase_03 AC 373 ms
27,928 KB
testcase_04 AC 163 ms
26,036 KB
testcase_05 AC 348 ms
27,912 KB
testcase_06 AC 234 ms
27,976 KB
testcase_07 AC 597 ms
26,104 KB
testcase_08 AC 268 ms
30,024 KB
testcase_09 AC 510 ms
27,928 KB
testcase_10 AC 449 ms
25,908 KB
testcase_11 AC 344 ms
25,944 KB
testcase_12 AC 455 ms
28,008 KB
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections.Generic;
using System.Linq;
using System.Numerics;
static public class Program
{
    //small
    static public void Main()
    {
        var max = BigInteger.Pow(10, 6);
        var S = readString(2).ValidateArray(x =>
        {
            var v = BigInteger.Parse(x);
            return 1 <= v && v <= max;
        });
        readEOF();
        const long mod = (long)1e9 + 9;
        var M = int.Parse(S[0]);
        var D = int.Parse(S[1]);
        var a = new int[5000];
        long ans = 0;
        for (int i = 1; i <= M; i++)
            a[i.ToString().Select(x => x - '0').Sum()]++;
        for (int i = 1; i <= D; i++)
            ans += a[i.ToString().Select(x => x - '0').Sum()];
        Console.WriteLine(ans % mod);
    }
    static string[] readString(int n)
    {
        var s = Console.ReadLine().Split(' ');
        if (s.Length != n)
            throw new Exception(string.Format("invalid input, expected{0} actual{1}", n, s.Length));
        return s;
    }
    static void readEOF()
    {
        if (Console.In.Peek() >= 0)
            throw new Exception("invalid input too long input file");
    }

}
static public class Ex
{
    static public T[] ValidateArray<T>(this T[] input, Func<T, bool> f)
    {
        foreach (var x in input)
            if (!f(x))
                throw new Exception("invalid input");
        return input;
    }
}
0