10457 | 2024-04-02 23:09:45 | 111 | Fibonacci Sequences | cpp17 | Wrong answer 75/100 | 179ms | 20488 KiB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
vector<int>f,v,F;
map<int,int>m;
void solve(int x,int i,int c,int d){
if(x>1000000000){
return;
}
if(d){
int ans=1;
v.push_back(c);
int dd=d;
for(int j:v){
ans*=F[dd]/F[j]/F[dd-j];
dd-=j;
}
m[x]+=ans;
v.pop_back();
}
for(int j=i;j<f.size();j++){
if(j==i){
solve(x*f[j],j,c+1,d+1);
}
else{
v.push_back(c);
solve(x*f[j],j,1,d+1);
v.pop_back();
}
}
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
f.push_back(1);
f.push_back(2);
F.push_back(1);
for(int i=0;i<42;i++){
f.push_back(*--f.end()+*----f.end());
F.push_back(F.back()*(i+1));
}
solve(1,1,0,0);
int T;
cin>>T;
while(T--){
int M;
cin>>M;
cout<<m[M]<<'\n';
}
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 112ms | 11480 KiB | ||||
2 | Accepted | 112ms | 11644 KiB | ||||
subtask2 | 25/25 | ||||||
3 | Accepted | 112ms | 11876 KiB | ||||
4 | Accepted | 112ms | 11952 KiB | ||||
5 | Accepted | 112ms | 12068 KiB | ||||
6 | Accepted | 112ms | 12172 KiB | ||||
subtask3 | 25/25 | ||||||
7 | Accepted | 112ms | 12272 KiB | ||||
8 | Accepted | 111ms | 12252 KiB | ||||
9 | Accepted | 111ms | 12280 KiB | ||||
10 | Accepted | 111ms | 12360 KiB | ||||
subtask4 | 25/25 | ||||||
11 | Accepted | 166ms | 18812 KiB | ||||
12 | Accepted | 168ms | 19020 KiB | ||||
subtask5 | 0/25 | ||||||
13 | Wrong answer | 178ms | 19932 KiB | ||||
14 | Wrong answer | 179ms | 20488 KiB |