제출 #19666

#제출 시각아이디문제언어결과실행 시간메모리
19666chan492811괄호 (kriii4_R)C++98
0 / 100
0 ms5768 KiB
#include <cstdio> #include <algorithm> #define ll long long #define mod 1000000007 ll n,k,res,now=1; ll table[200010],stable[200010],sstable[200010]; int main(){ int i; scanf("%lld %lld",&n,&k); table[0]=1; stable[0]=1; sstable[0]=k; for(i=2;i<=2*n;i+=2){ table[i]=sstable[i-2]; stable[i]=stable[i-2]+table[i]; stable[i]%=mod; sstable[i]=sstable[i-2]*k+table[i]*k; sstable[i]%=mod; } for(i=0;i<=n;i++){ res+=table[n-i]*now; now*=k; res%=mod; } printf("%lld",res); return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...