Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <fstream>
- #include <cstdio>
- #include <cstdlib>
- #include <string>
- using namespace std;
- void rec_count(unsigned long long &count, int A, int B, int n){
- // A >= B
- if(A == n) count++;
- else if(A == B) rec_count(count, A+1, B, n);
- else if(A > B){
- rec_count(count, A+1, B, n);
- rec_count(count, A, B+1, n);
- }
- }
- int main() {
- string filename;
- cin >> filename;
- ifstream inputFile(filename.c_str());
- int t, n;
- unsigned long long count;
- inputFile >> t;
- cout << t << endl;
- for(int i = 0; i < t; i++){
- count = 0;
- inputFile >> n;
- rec_count(count, 1, 0, n);
- cout << count << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement