#include <bits/stdc++.h> using namespace std; /* 000 001 010 011 100 101 110 111 */ int main() { int n, s, sum, total, tmp; cin >> n; for(int i = 1; i <= n; i++){ cin >> s; if(s == 1){ cout << "Scenario #" << i << ":" << endl << "2" << endl; continue; } total = pow(2, s); sum = total / 4 * 3; for(int j = 0; j < total / 4 * 3; j++){ tmp = j; while(tmp){ if(tmp % 2 && (tmp / 2) % 2){ sum --; break; } tmp /= 2; } } cout << "Scenario #" << i << ":" << endl << sum << endl; } return 0; } |
Double click to view unformatted code.