結果

問題 No.741 AscNumber(Easy)
ユーザー lumc_
提出日時 2018-10-05 21:31:18
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 53 ms / 2,000 ms
コード長 719 bytes
コンパイル時間 939 ms
コンパイル使用メモリ 102,500 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-12 12:53:28
合計ジャッジ時間 3,007 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 55
権限があれば一括ダウンロードができます

ソースコード

diff #

// includes {{{
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<vector>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<tuple>
#include<cmath>
#include<random>
#include<cassert>
// }}}
// #include<bits/stdc++.h>
using namespace std;
using ll = long long;
const int mod = 1e9 + 7;

int main() {
  std::ios::sync_with_stdio(false), std::cin.tie(0);
  int n;
  cin >> n;
  vector<ll> dp(10, 1);
  ll ans = 10;
  for(int i = 1; i < n; i++) {
    vector<ll> dps = dp;
    for(int j = 1; j < 10; j++) dps[j+1]=(dps[j+1]+dps[j])%mod;
    for(int j = 1; j <= 9; j++) {
      dp[j] = dps[j];
      ans += dp[j];
    }
  }
  ans %= mod;
  cout << ans << endl;
  return 0;
}
0