Submission #20051

#TimeUsernameProblemLanguageResultExecution timeMemory
20051ilbbke동전 (kriii4_E)C++98
0 / 100
0 ms1084 KiB
#include<stdio.h> int n,arr[255]; long long ans=1; void back(int x,int c,int w) { int i,j; if(c>0 && c%2==0) ans++; for(i=w;i<=n;i++){ if(i+x-1>n) break; if(arr[i-1]) continue; for(j=i;j<i+x;j++){ if(arr[j]) break; } if(j!=i+x) continue; for(j=i;j<i+x;j++) arr[j]=1; back(x,c+1,i+x); for(j=i;j<i+x;j++) arr[j]=0; } } int main() { scanf("%d",&n); int i; for(i=1;i<=n/2;i++){ back(i,0,1); } printf("%lld",ans); return 0; } /* #include<stdio.h> #define M 1000000007 long long dy[1000005]; int main() { int i,n,k; scanf("%d %d",&n,&k); dy[1]=1; dy[2]=2; for(i=3;i<=n;i++) { dy[i]=(dy[i-1]+dy[i-2])%M; } printf("%lld",dy[n]); return 0; } */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...