#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0)
#define mem(dp,x) memset(dp,x,sizeof(dp))
#define pii pair<int,int>
#include <bits/stdc++.h>
#define pll pair<ll,ll>
#define ll long long
#define pb push_back
#define mid (l+r)/2
#define S second
#define F first
using namespace std;
const int inf = 1e9+9;
const ll mod = 1e9+7;
ll n,s;
ll a[109];
ll F[109];
ll bt(ll id,ll sum){
if(id == 21){
if(sum == s) return 1;
return 0;
}
return (bt(id+1,sum)+bt(id+1,sum+F[id]))%mod;
}
int main(){
fast,cin>>n;
for(int i=0;i<n;i++){
cin>>a[i];
}
F[1] = 1; F[2] = 2;
for(int i=3;i<=20;i++){
F[i] = F[i-1] + F[i-2];
}
for(int i=0;i<n;i++){
s += F[a[i]];
cout<<bt(1,0)<<endl;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
95 ms |
204 KB |
Output is correct |
2 |
Correct |
144 ms |
204 KB |
Output is correct |
3 |
Correct |
141 ms |
316 KB |
Output is correct |
4 |
Correct |
10 ms |
204 KB |
Output is correct |
5 |
Correct |
135 ms |
204 KB |
Output is correct |
6 |
Correct |
141 ms |
312 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
95 ms |
204 KB |
Output is correct |
2 |
Correct |
144 ms |
204 KB |
Output is correct |
3 |
Correct |
141 ms |
316 KB |
Output is correct |
4 |
Correct |
10 ms |
204 KB |
Output is correct |
5 |
Correct |
135 ms |
204 KB |
Output is correct |
6 |
Correct |
141 ms |
312 KB |
Output is correct |
7 |
Correct |
691 ms |
204 KB |
Output is correct |
8 |
Incorrect |
956 ms |
204 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
288 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
95 ms |
204 KB |
Output is correct |
2 |
Correct |
144 ms |
204 KB |
Output is correct |
3 |
Correct |
141 ms |
316 KB |
Output is correct |
4 |
Correct |
10 ms |
204 KB |
Output is correct |
5 |
Correct |
135 ms |
204 KB |
Output is correct |
6 |
Correct |
141 ms |
312 KB |
Output is correct |
7 |
Correct |
691 ms |
204 KB |
Output is correct |
8 |
Incorrect |
956 ms |
204 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
4057 ms |
204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
95 ms |
204 KB |
Output is correct |
2 |
Correct |
144 ms |
204 KB |
Output is correct |
3 |
Correct |
141 ms |
316 KB |
Output is correct |
4 |
Correct |
10 ms |
204 KB |
Output is correct |
5 |
Correct |
135 ms |
204 KB |
Output is correct |
6 |
Correct |
141 ms |
312 KB |
Output is correct |
7 |
Correct |
691 ms |
204 KB |
Output is correct |
8 |
Incorrect |
956 ms |
204 KB |
Output isn't correct |
9 |
Halted |
0 ms |
0 KB |
- |