Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- #define lli long long int
- using namespace std;
- void compute(lli n, lli& ans, bool flag = false) {
- if (n == 0) {
- ans += 1;
- return;
- }
- compute(n - 1, ans, false);
- if (!flag) {
- compute(n - 1, ans, true);
- }
- }
- int main()
- {
- lli t, n, ans, i=1;
- cin>>t;
- while(i<=t)
- {
- ans=0;
- cin >> n;
- compute(n, ans);
- cout << "#" << i << " : " << ans << endl;
- i++;
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment