编号 题目 状态 分数 总时间 内存 代码 / 答案文件 提交者 提交时间
#33248 #2060. 学霸题 Accepted 100 232 ms 424 K C++ 17 / 1.1 K C192023211755 2025-03-22 16:46:58
显示原始代码
#include <cstring>
#include <iostream>
#include <algorithm>
#include <cmath>
#include <vector>
using namespace std;
#define int long long


signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int T = 1;
    vector<vector<int>> dp(12, vector<int>(100, 0));
    for (int i = 0; i <= 9; i++) {
        dp[1][i] = 1;
    }
    dp[0][0] = 1;

    for (int i = 2; i <= 10; i++) {
        for (int j = 0; j <= 90; j++) {
            // dp[i][j]+=dp[i-1][j];
            for (int k = 0; k <= 9; k++) {
                if (j >= k) {
                    dp[i][j] += dp[i - 1][j - k];
                }
            }
        }
    }
    //  for(int i=1;i<=10;i++){
    //     for(int j=1;j<=20;j++){
    //         cout<<"i:"<<i<<' '<<"j:"<<j<<" ";
    //         cout<<dp[i][j]<<endl;
    //     }
    //  }
    cin >> T;
    while (T--) {
        int k;
        cin >> k;

        if (k == 0) {
            cout << 1 << endl;
            continue;
        }
        if (k == 1) {
            cout << 11 << endl;
            continue;
        }
        if (k > 90) {
            cout << 0 << endl;
            continue;
        }
        cout << dp[10][k] << endl;
    }
    return 0;
}
子任务 #1
Accepted
得分:100
测试点 #1
Accepted
得分:100
用时:3 ms
内存:412 KiB

输入文件(1.in

1
0

答案文件(1.out

1

用户输出

1

系统信息

Exited with return code 0
测试点 #2
Accepted
得分:100
用时:229 ms
内存:424 KiB

输入文件(2.in

100000
119193704883053754
139940092127619437
386274160967300890
549311792560909352
282664831212
<1985803 bytes omitted>

答案文件(2.out

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
<300442 bytes omitted>

用户输出

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

<200414 bytes omitted>

系统信息

Exited with return code 0