104572024-04-02 23:09:45111Fibonacci Sequencescpp17Wrong answer 75/100179ms20488 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;
}
SubtaskSumTestVerdictTimeMemory
subtask10/0
1Accepted112ms11480 KiB
2Accepted112ms11644 KiB
subtask225/25
3Accepted112ms11876 KiB
4Accepted112ms11952 KiB
5Accepted112ms12068 KiB
6Accepted112ms12172 KiB
subtask325/25
7Accepted112ms12272 KiB
8Accepted111ms12252 KiB
9Accepted111ms12280 KiB
10Accepted111ms12360 KiB
subtask425/25
11Accepted166ms18812 KiB
12Accepted168ms19020 KiB
subtask50/25
13Wrong answer178ms19932 KiB
14Wrong answer179ms20488 KiB