Submission #19806

#TimeUsernameProblemLanguageResultExecution timeMemory
19806myungwoo동전 (kriii4_E)C++14
100 / 100
33 ms17900 KiB
#include<stdio.h> #include<memory.h> #define mod 1000000007 #define inv(a) exp(a,mod-2) typedef long long lld; lld exp(lld a, lld b){ if(b==0)return 1; lld k=exp(a, b/2); k=(k*k)%mod; if(b%2)k=(k*a)%mod; return k; } lld fac[1001001], rfac[1001001]; void init(){ lld i; fac[0]=rfac[0]=1; for(i=1; i<=1000000; i++){ fac[i]=(fac[i-1]*i)%mod; rfac[i]=inv(fac[i]); } } lld comb(lld a, lld b){ return fac[a]*rfac[b]%mod*rfac[a-b]%mod; } lld n, grd[251], dy[251][600]; int main(){ lld i, j, k; // init(); scanf("%d", &n); for(i=1; i<=n; i++)grd[i]=i; dy[0][0]=1; for(i=1; i<=n; i++){ for(j=0; j<512; j++){ if(grd[i]==j)dy[i][j]++; for(k=0; k<i; k++)dy[i][j]+=dy[k][j^grd[i-k-1]]; dy[i][j]%=mod; } } printf("%lld", dy[n][0]); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...