結果
| 問題 | No.41 貯金箱の溜息(EASY) | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-04-01 22:08:06 | 
| 言語 | Java (openjdk 23) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 176 ms / 5,000 ms | 
| コード長 | 1,733 bytes | 
| コンパイル時間 | 3,797 ms | 
| コンパイル使用メモリ | 78,996 KB | 
| 実行使用メモリ | 42,368 KB | 
| 最終ジャッジ日時 | 2024-10-02 08:57:28 | 
| 合計ジャッジ時間 | 4,607 ms | 
| ジャッジサーバーID (参考情報) | judge3 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 2 | 
ソースコード
import java.io.*;
import java.util.*;
public class Main_yukicoder41 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Printer pr = new Printer(System.out);
		final int MOD = 1_000_000_009;
		int n = (int)(10_000_000_000L / 111111);
		long[] dp = new long[n + 1];
		dp[0] = 1;
		for (int j = 0; j <= 9; j++) {
			int tmp;
			if (j == 0) {
				tmp = 1;
			} else {
				tmp = j;
			}
			for (int i = tmp; i <= n; i++) {
				dp[i] = (dp[i - tmp] + dp[i]) % MOD;
			}
		}
		int t = sc.nextInt();
		for (int tcase = 0; tcase < t; tcase++) {
			long m = sc.nextLong();
			pr.println(dp[(int)(m / 111111)]);
		}
		pr.close();
        sc.close();
    }
	@SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;
		Iterator<String> it;
		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}
		String next() throws RuntimeException  {
			try {
				if (it == null || !it.hasNext()) {
					it = Arrays.asList(br.readLine().split(" ")).iterator();
				}
				return it.next();
			} catch (IOException e) {
				throw new IllegalStateException();
			}
		}
		int nextInt() throws RuntimeException {
			return Integer.parseInt(next());
		}
		long nextLong() throws RuntimeException {
			return Long.parseLong(next());
		}
		float nextFloat() throws RuntimeException {
			return Float.parseFloat(next());
		}
		double nextDouble() throws RuntimeException {
			return Double.parseDouble(next());
		}
		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new IllegalStateException();
			}
		}
	}
	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
            
            
            
        