結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー tentententen
提出日時 2023-11-21 13:07:40
言語 Java21
(openjdk 21)
結果
WA  
実行時間 -
コード長 2,519 bytes
コンパイル時間 2,837 ms
コンパイル使用メモリ 90,364 KB
実行使用メモリ 60,792 KB
最終ジャッジ日時 2023-11-21 13:07:48
合計ジャッジ時間 7,477 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 53 ms
53,988 KB
testcase_01 AC 53 ms
53,996 KB
testcase_02 AC 57 ms
54,016 KB
testcase_03 AC 53 ms
53,988 KB
testcase_04 AC 52 ms
54,012 KB
testcase_05 AC 52 ms
53,988 KB
testcase_06 WA -
testcase_07 AC 53 ms
52,084 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 53 ms
54,008 KB
testcase_11 AC 56 ms
53,996 KB
testcase_12 AC 53 ms
53,988 KB
testcase_13 AC 54 ms
53,972 KB
testcase_14 AC 55 ms
53,968 KB
testcase_15 AC 55 ms
53,984 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 AC 56 ms
54,004 KB
testcase_20 RE -
testcase_21 AC 58 ms
54,012 KB
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 60 ms
53,972 KB
testcase_25 RE -
testcase_26 AC 62 ms
53,996 KB
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 88 ms
55,432 KB
testcase_32 RE -
testcase_33 AC 105 ms
57,604 KB
testcase_34 AC 118 ms
60,204 KB
testcase_35 AC 120 ms
60,172 KB
testcase_36 AC 125 ms
60,304 KB
testcase_37 RE -
testcase_38 AC 127 ms
60,792 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.*;
import java.util.*;
import java.util.stream.*;

public class Main {
    static final int MOD = 1000000007;
    public static void main(String[] args) throws Exception {
        Scanner sc = new Scanner();
        char[] inputs = sc.next().toCharArray();
        int[][] dp = new int[inputs.length][100];
        for (int i = 1; i < inputs[0] - '0'; i++) {
            dp[0][i] = 1;
        }
        int base = inputs[0] - '0';
        boolean isZero = false;
        for (int i = 1; i < inputs.length; i++) {
            int x = inputs[i] - '0';
            for (int j = 0; j < 100; j++) {
                for (int k = 1; k < 10; k++) {
                    dp[i][(j * k) % 100] += dp[i - 1][j];
                    dp[i][(j * k) % 100] %= MOD;
                }
            }
            for (int j = 1; j < 10; j++) {
                dp[i][j]++;
            }
            if (isZero) {
                continue;
            }
            for (int j = 1; j < x; j++) {
                dp[i][(base * j) % 100]++;
            }
            if (x == 0) {
                isZero = true;
            }
            base *= x;
        }
        if (!isZero && base == 0) {
            dp[inputs.length - 1][0]++;
        }
        System.out.println(dp[inputs.length - 1][0]);
    }
}
class Utilities {
    static String arrayToLineString(Object[] arr) {
        return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n"));
    }
    
    static String arrayToLineString(int[] arr) {
        return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new));
    }
}
class Scanner {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    StringTokenizer st = new StringTokenizer("");
    StringBuilder sb = new StringBuilder();
    
    public Scanner() throws Exception {
        
    }
    
    public int nextInt() throws Exception {
        return Integer.parseInt(next());
    }
    
    public long nextLong() throws Exception {
        return Long.parseLong(next());
    }
    
    public double nextDouble() throws Exception {
        return Double.parseDouble(next());
    }
    
    public int[] nextIntArray() throws Exception {
        return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
    }
    
    public String next() throws Exception {
        while (!st.hasMoreTokens()) {
            st = new StringTokenizer(br.readLine());
        }
        return st.nextToken();
    }
    
}
0