結果

問題 No.741 AscNumber(Easy)
ユーザー 0w10w1
提出日時 2018-10-09 17:51:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 275 ms / 2,000 ms
コード長 644 bytes
コンパイル時間 2,191 ms
コンパイル使用メモリ 200,768 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-20 19:09:59
合計ジャッジ時間 7,079 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 3 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 2 ms
5,376 KB
testcase_26 AC 2 ms
5,376 KB
testcase_27 AC 2 ms
5,376 KB
testcase_28 AC 2 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 2 ms
5,376 KB
testcase_31 AC 2 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 3 ms
5,376 KB
testcase_35 AC 267 ms
5,376 KB
testcase_36 AC 118 ms
5,376 KB
testcase_37 AC 136 ms
5,376 KB
testcase_38 AC 134 ms
5,376 KB
testcase_39 AC 113 ms
5,376 KB
testcase_40 AC 153 ms
5,376 KB
testcase_41 AC 239 ms
5,376 KB
testcase_42 AC 128 ms
5,376 KB
testcase_43 AC 94 ms
5,376 KB
testcase_44 AC 189 ms
5,376 KB
testcase_45 AC 203 ms
5,376 KB
testcase_46 AC 253 ms
5,376 KB
testcase_47 AC 45 ms
5,376 KB
testcase_48 AC 250 ms
5,376 KB
testcase_49 AC 211 ms
5,376 KB
testcase_50 AC 30 ms
5,376 KB
testcase_51 AC 97 ms
5,376 KB
testcase_52 AC 275 ms
5,376 KB
testcase_53 AC 275 ms
5,376 KB
testcase_54 AC 275 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

const int M = int(1e9 + 7);

signed main() {
  ios::sync_with_stdio(false);
  
  int N;
  cin >> N;
  
  vector<vector<int>> dp(2, vector<int>(10));
  dp[0][0] = 1;
  
  for (int i = 0; i < N; ++i) {
    vector<vector<int>> ndp(2, vector<int>(10));
    for (int j = 0; j < 2; ++j) {
      for (int k = 0; k < 10; ++k) {
        for (int l = k; l < 10; ++l) {
          (ndp[j | l < 10][l] += dp[j][k]) %= M;
        }
      }
    }
    swap(dp, ndp);
  }
  
  int ans = 0;
  for (int i = 0; i < 2; ++i)
    for (int j = 0; j < 10; ++j)
      (ans += dp[i][j]) %= M;
      
  cout << ans << endl;
}
0