結果

問題 No.741 AscNumber(Easy)
ユーザー tetsuzuki1115tetsuzuki1115
提出日時 2018-10-07 17:36:21
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 279 ms / 2,000 ms
コード長 677 bytes
コンパイル時間 813 ms
コンパイル使用メモリ 91,804 KB
実行使用メモリ 128,640 KB
最終ジャッジ日時 2024-04-20 18:16:25
合計ジャッジ時間 5,445 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1 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 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 1 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 1 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 1 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 2 ms
5,376 KB
testcase_20 AC 1 ms
5,376 KB
testcase_21 AC 1 ms
5,376 KB
testcase_22 AC 1 ms
5,376 KB
testcase_23 AC 2 ms
5,376 KB
testcase_24 AC 1 ms
5,376 KB
testcase_25 AC 1 ms
5,376 KB
testcase_26 AC 2 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 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 1 ms
5,376 KB
testcase_35 AC 263 ms
122,624 KB
testcase_36 AC 116 ms
55,552 KB
testcase_37 AC 140 ms
64,640 KB
testcase_38 AC 134 ms
63,872 KB
testcase_39 AC 117 ms
54,400 KB
testcase_40 AC 155 ms
72,704 KB
testcase_41 AC 237 ms
112,128 KB
testcase_42 AC 128 ms
61,184 KB
testcase_43 AC 94 ms
45,056 KB
testcase_44 AC 193 ms
88,704 KB
testcase_45 AC 207 ms
95,360 KB
testcase_46 AC 252 ms
116,736 KB
testcase_47 AC 45 ms
22,528 KB
testcase_48 AC 248 ms
116,864 KB
testcase_49 AC 213 ms
98,176 KB
testcase_50 AC 31 ms
16,256 KB
testcase_51 AC 99 ms
47,104 KB
testcase_52 AC 275 ms
128,640 KB
testcase_53 AC 275 ms
128,512 KB
testcase_54 AC 279 ms
127,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <unordered_map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;

long long MOD = 1000000007;

long long A[1000000+10][10] = {0};

long long func( long long n, long long r ) {

    if ( A[n][r] ) { return A[n][r]; }

    if ( n/2 < r ) { r = n-r; }
    if ( r == 0 ) { return 1; }

    A[n][r] = ( func(n-1,r)+func(n-1,r-1) )%MOD;
    return A[n][r];

}

int main() {
    
    long long N;
    cin >> N;

    cout << func( N+9, 9 ) << endl;

    return 0;
}
0