diff --git a/SDUTOJ/3561.cpp b/SDUTOJ/3561.cpp new file mode 100644 index 0000000..ca2755e --- /dev/null +++ b/SDUTOJ/3561.cpp @@ -0,0 +1,68 @@ +#include +#include +#include +#include +using namespace std; +typedef long long LL; + +LL a[50]; +LL b[50]; + +/// Print Table +void init() +{ + a[0]=1; + a[1]=2; + for(int i=2;i<48;i++) + { + a[i]=a[i-1]+a[i-2]; + } +} + +int _ans; +int dfs(LL cVal,int cidx,int bidx) +{ + if(cVal==0) + { + _ans=bidx;return 1; + } + if(cidx==-1) return 0; + for(int i=cidx;i>=0;i--) + { + if(cVal>=a[i]) + { + b[bidx]=a[i]; + int ret=dfs(cVal-a[i],i-1,bidx+1); + if(ret) return 1; + } + } + return 0; +} + +int main() +{ + init(); + int n; + scanf("%d",&n); + LL t; + for(int cc=0;cc