【題解】AtCoder ABC 185C – Duodecim Ferra

【題目敘述】https://atcoder.jp/contests/abc185/tasks/abc185_c
【解題想法】DP

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

long long l, dp[205][15], pre[205][15];

int main(){
    cin >> l;
    l--;
    dp[0][1] = 1;
    for (int i = 1; i <= 12; i++){
        for (int j = 1; j <= l; j++){
            dp[j][i] = dp[j-1][i]+dp[j-1][i-1];
        }
    }
    cout << dp[l][12];
}

分享本文 Share with friends