#include <bits/stdc++.h> using namespace std; /* 2 3 5 8 13 21 34 55 89 */ int main() { int n, s; long long int sum, total, tmp, head, tail; cin >> n; for(int i = 1; i <= n; i++){ cin >> s; head = 2, tail = 3; if(s == 1) sum = 2; else{ for(int j = 1; j < s; j++){ tmp = tail; tail += head; head = tmp; } sum = head; } cout << "Scenario #" << i << ":" << endl << sum << endl; } return 0; } |
Double click to view unformatted code.