結果

問題 No.741 AscNumber(Easy)
ユーザー niiminiimi
提出日時 2018-10-05 21:42:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 970 bytes
コンパイル時間 1,503 ms
コンパイル使用メモリ 158,436 KB
実行使用メモリ 73,728 KB
最終ジャッジ日時 2024-04-20 17:07:26
合計ジャッジ時間 4,049 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 1 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 1 ms
5,376 KB
testcase_17 AC 1 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 1 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 1 ms
5,376 KB
testcase_24 AC 2 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 1 ms
5,376 KB
testcase_27 AC 1 ms
5,376 KB
testcase_28 AC 1 ms
5,376 KB
testcase_29 AC 2 ms
5,376 KB
testcase_30 AC 1 ms
5,376 KB
testcase_31 AC 1 ms
5,376 KB
testcase_32 AC 1 ms
5,376 KB
testcase_33 AC 2 ms
5,376 KB
testcase_34 AC 2 ms
5,376 KB
testcase_35 AC 123 ms
70,528 KB
testcase_36 AC 59 ms
32,512 KB
testcase_37 AC 68 ms
37,632 KB
testcase_38 AC 62 ms
37,248 KB
testcase_39 AC 54 ms
31,872 KB
testcase_40 AC 72 ms
42,240 KB
testcase_41 AC 116 ms
64,512 KB
testcase_42 AC 62 ms
35,712 KB
testcase_43 AC 43 ms
26,752 KB
testcase_44 AC 90 ms
51,328 KB
testcase_45 AC 96 ms
55,040 KB
testcase_46 AC 118 ms
67,072 KB
testcase_47 AC 23 ms
14,080 KB
testcase_48 AC 118 ms
67,072 KB
testcase_49 AC 100 ms
56,576 KB
testcase_50 AC 16 ms
10,624 KB
testcase_51 AC 48 ms
27,904 KB
testcase_52 AC 132 ms
73,600 KB
testcase_53 AC 128 ms
73,728 KB
testcase_54 AC 131 ms
72,960 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

typedef unsigned long long ll;
typedef std::pair<int, int> P;

#define For(i, a, b) for(int i = (a); i < (b); i++)
#define Rep(i, n) For(i, 0, (n))
#define Rrep(i, n) for(int i = (n - 1); i >= 0; i--)
#define All(i, x) for(typeof(x.begin()) i = x.begin(); i != x.end(); i++)
#define ReAll(i, x) for(typeof(x.end()) i = x.end(); i != x.begin(); i--)
#define pb push_back

const int dx[4] = {1, 0, -1, 0}, dy[4] = {0, 1, 0, -1};
const int MAX = 100000;
const int INF = 1e9;
const int MOD = 1000000007;
const string END = "\n";

void solve(){
	ll n; cin >> n;
	ll a[n][9];
	ll ans = 0;
	Rep(i, n){
		Rep(j, 9){
			if(i == 0){
				a[i][j] = 1;
				ans += 1;
			}else{
				ll tmp = 0;
				Rep(k, j+1){
					tmp += a[i-1][k];
					tmp %= MOD;
				}
				a[i][j] = tmp;
				ans += tmp;
				ans %= MOD;
			}
		}
	}
	cout << (ans + 1) % MOD << END;
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	solve();
	return 0;
}
0