2016年11月10日 星期四

TIOJ 1296 - 第二題 擺數字問題

http://tioj.infor.org/problems/1296

公式都給你了 不用白不用阿



 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#include<iostream>
#define ll long long
using namespace std;
ll F[20];
inline void I(){
    F[1]=1;
    for(int i=2;i<20;i++){
        F[i]=F[i-1]*(4*i-2)/(i+1);
    }
    return;
}
int main(){
    // cin.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    I();
    while(cin>>n){
        cout<<F[n]<<'\n';
    }
}

沒有留言:

張貼留言