专栏文章
11.29T3
生活·游记参与者 1已保存评论 0
文章操作
快速查看文章及其快照的属性,并进行相关操作。
- 当前评论
- 0 条
- 当前快照
- 1 份
- 快照标识符
- @mimydrqj
- 此快照首次捕获于
- 2025/12/01 17:34 3 个月前
- 此快照最后确认于
- 2025/12/01 17:34 3 个月前
CPP
#include <bits/stdc++.h>
using namespace std;
#define int long long
int n,fib[100],ans;bool vis[100000000];
void dfs(int x2,int x3,int x8,int x144) {
if(vis[x2*1000000+x3*10000+x8*100+x144]) return;
ans++;vis[x2*10000000+x3*10000+x8*100+x144]=1;
if(x2>=3) dfs(x2-3,x3,x8+1,x144);
if(x2>=1&&x3>=2&&x8>=1) dfs(x2-1,x3-2,x8-1,x144+1);
}
void work() {
cin>>n;ans=0;
int s2=0,s3=0;
for(int i=85;i>=3;i--) {
if(fib[i]==8||fib[i]==144) continue;
while(n%fib[i]==0) n/=fib[i];
}
while(n%2==0) n/=2,s2++;
while(n%3==0) n/=3,s3++;
if(n>1){cout<<"0\n";return;}
dfs(s2,s3,0,0);cout<<ans<<"\n";
}
signed main() {
freopen("fibonacci.in","r",stdin);
freopen("fibonacci.out","w",stdout);
ios::sync_with_stdio(0);cin.tie(0);
for(int a=1,b=2,i=1;b<=1e18;i++) {
fib[i]=b;int t=a+b;a=b;b=t;
}int T;cin>>T;while(T--) work();
}
完了,突然发现我多测没清空
大样例过了,小样例没过
vis数组大样例过了,小样例没过
相关推荐
评论
共 0 条评论,欢迎与作者交流。
正在加载评论...