Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //UVa Q580
- #include <bits/stdc++.h>
- using namespace std;
- int32_t main(){
- int arr[31] = {1,2,4};
- for(int i = 3; i <= 30; ++i)arr[i] = arr[i-1] + arr[i-2] + arr[i-3];
- int n;
- while(cin >> n){
- if(n == 0)break;
- cout << (1<<n) - arr[n] << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment