Submission #19757

#TimeUsernameProblemLanguageResultExecution timeMemory
19757ainta동전 (kriii4_E)C++98
5 / 100
9 ms1212 KiB
#include<stdio.h> int D[32768]; void Do(int x, int pv, int s){ if(pv==15|| !(x&(1<<pv))){ if(!D[x^s])D[x]=1; return; } Do(x,pv+1,s); Do(x,pv+1,s|(1<<pv)); } int main(){ int i, j, k, res, n; D[0] = 0; for(i=1;i<32768;i++){ for(j=0;j<15;j++){ if((1<<j)&i)Do(i,j+1,(1<<j)); } } /* for(i=1;i<=15;i++){ res = 0; for(j=0;j<(1<<i);j++)if(D[j]==0)res++; printf("%d\n",res); }*/ scanf("%d",&n); if(n<=15){ res = 0; for(i=0;i<(1<<n);i++)if(D[i]==0)res++; printf("%d\n",res); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...