This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve(){
vector<int> fb(16);
fb[1] = 1;
fb[2] = 2;
for(int i = 3;i <= 15;i++){
fb[i] = fb[i - 1] + fb[i - 2];
}
int sum = 15000;
vector<int> dp(sum + 1);
for(int mask = 0;mask < (1 << 15);mask++){
int now = 0;
for(int i = 0;i < 15;i++){
if(mask >> i & 1){
now += fb[i + 1];
}
}
dp[now]++;
}
int n;
cin >> n;
int pref = 0;
for(int i = 0;i < n;i++){
int a;
cin >> a;
pref += fb[a];
cout << dp[pref] << "\n";
}
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0),cout.tie(0);
int t = 1;
//~ cin >> t;
while(t--){
solve();
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |