結果
問題 | No.741 AscNumber(Easy) |
ユーザー | みしあ |
提出日時 | 2023-04-05 17:29:44 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 498 ms / 2,000 ms |
コード長 | 2,461 bytes |
コンパイル時間 | 4,217 ms |
コンパイル使用メモリ | 254,340 KB |
実行使用メモリ | 222,392 KB |
最終ジャッジ日時 | 2024-04-10 01:06:19 |
合計ジャッジ時間 | 13,900 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
159,764 KB |
testcase_01 | AC | 40 ms
159,912 KB |
testcase_02 | AC | 40 ms
159,868 KB |
testcase_03 | AC | 41 ms
159,748 KB |
testcase_04 | AC | 41 ms
159,668 KB |
testcase_05 | AC | 41 ms
159,788 KB |
testcase_06 | AC | 41 ms
159,820 KB |
testcase_07 | AC | 41 ms
159,872 KB |
testcase_08 | AC | 42 ms
159,840 KB |
testcase_09 | AC | 41 ms
159,892 KB |
testcase_10 | AC | 41 ms
159,868 KB |
testcase_11 | AC | 48 ms
159,800 KB |
testcase_12 | AC | 41 ms
159,772 KB |
testcase_13 | AC | 41 ms
159,880 KB |
testcase_14 | AC | 42 ms
159,704 KB |
testcase_15 | AC | 41 ms
159,844 KB |
testcase_16 | AC | 42 ms
159,772 KB |
testcase_17 | AC | 41 ms
159,828 KB |
testcase_18 | AC | 43 ms
159,792 KB |
testcase_19 | AC | 42 ms
159,836 KB |
testcase_20 | AC | 41 ms
159,764 KB |
testcase_21 | AC | 42 ms
159,908 KB |
testcase_22 | AC | 42 ms
159,860 KB |
testcase_23 | AC | 43 ms
159,872 KB |
testcase_24 | AC | 43 ms
159,844 KB |
testcase_25 | AC | 42 ms
159,768 KB |
testcase_26 | AC | 42 ms
159,692 KB |
testcase_27 | AC | 41 ms
159,880 KB |
testcase_28 | AC | 42 ms
159,772 KB |
testcase_29 | AC | 43 ms
159,828 KB |
testcase_30 | AC | 42 ms
159,956 KB |
testcase_31 | AC | 42 ms
159,832 KB |
testcase_32 | AC | 41 ms
159,748 KB |
testcase_33 | AC | 42 ms
159,876 KB |
testcase_34 | AC | 42 ms
159,884 KB |
testcase_35 | AC | 471 ms
219,324 KB |
testcase_36 | AC | 231 ms
185,744 KB |
testcase_37 | AC | 267 ms
190,300 KB |
testcase_38 | AC | 263 ms
190,004 KB |
testcase_39 | AC | 223 ms
185,124 KB |
testcase_40 | AC | 296 ms
194,388 KB |
testcase_41 | AC | 435 ms
214,180 KB |
testcase_42 | AC | 250 ms
188,624 KB |
testcase_43 | AC | 192 ms
180,712 KB |
testcase_44 | AC | 356 ms
202,448 KB |
testcase_45 | AC | 374 ms
205,812 KB |
testcase_46 | AC | 456 ms
216,452 KB |
testcase_47 | AC | 111 ms
169,388 KB |
testcase_48 | AC | 455 ms
216,580 KB |
testcase_49 | AC | 384 ms
207,164 KB |
testcase_50 | AC | 89 ms
166,236 KB |
testcase_51 | AC | 199 ms
181,864 KB |
testcase_52 | AC | 495 ms
222,392 KB |
testcase_53 | AC | 497 ms
222,360 KB |
testcase_54 | AC | 498 ms
221,844 KB |
ソースコード
#pragma region Macros #include <bits/stdc++.h> #if defined(LOCAL) || defined(ONLINE_JUDGE) || defined(_DEBUG) #include <atcoder/all> #endif using namespace std; #define REP(i, n) for(int i=0, i##_len=(n); i<i##_len; ++i) #define REPR(i, n) for(int i=(n); i>=0; --i) #define FOR(i, n, m) for(int i=(m), i##_len=(n); i<i##_len; ++i) #define EACH(i, v) for(const auto& i : v) #define ALL(x) (x).begin(),(x).end() #define ALLR(x) (x).rbegin(),(x).rend() template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; } template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; } template<class T>using vec = vector<T>; template<class T, class U>using umap = unordered_map<T, U>; template<class T>using uset = unordered_set<T>; using ll = long long; using ld = long double; using P = pair<ll, ll>; //using T = tuple<ll, ll, ll>; using vl = vec<ll>; #define fi first #define se second #define el endl constexpr ll INF = numeric_limits<ll>::max()/2-1; #pragma endregion #pragma region IOMacros template<class T> istream &operator>>(istream &stream, vec<T>& o){REP(i, o.size())stream >> o[i];return stream;} template<class T> ostream &operator<<(ostream &stream, vec<T>& objs){REP(i, objs.size())stream << objs[i] << " ";stream << el;return stream;} #define I(T, ...) ;T __VA_ARGS__;__i(__VA_ARGS__); void __i() {} template<class T, class... Ts> void __i(T&& o, Ts&&... args){cin >> o;__i(forward<Ts>(args)...);} void O() {cerr << el;} template<class T, class... Ts> void O(T&& o, Ts&&... args){cerr << o << " ";O(forward<Ts>(args)...);} #pragma endregion void Main(); int main(){ std::cin.tie(nullptr); std::cout << std::fixed << std::setprecision(15); Main(); return 0; } const ll mod = 1e9 + 7; ll dp[1000000+10][2][10]; void init_dp(){memset(dp, -1ll, sizeof(dp));} ll KK; // sumの部分は、問題によってどうするか決める ll rec(int k = 0, bool tight = true, int mn = 0) { if (k == KK) { // sumがどうなっていたらOKなのか考える return 1; } int x = 9; int e = (tight ? x : 9); auto &res = dp[k][tight][mn]; if (~res) return res; res = 0; for (int i = mn; i <= e; ++i) { // sumの部分は問題によってどうするか決める res += rec(k + 1, tight && i == e, max(mn, i)); res %= mod; } return res; } void Main(){ cin >> KK; init_dp(); cout << rec() << el; }