#54965: c++快速解(9行)


gary0115 (無資料)


"注意到"前十項為{1,2,5,14,42,132,429,1430,4862,16796}

可以用9行解出來

程式碼:

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

 

int main(){
    int n;
    vector<int>way{1,2,5,14,42,132,429,1430,4862,16796};
    bool first = true;
    while(cin >> n){
        if(!first){
            cout << '\n';
        }
        cout << way[n-1] << '\n';
        first = false;
    }
    return 0;
}