Submission #20190

#TimeUsernameProblemLanguageResultExecution timeMemory
20190rlatnwls괄호 (kriii4_R)C++98
Compilation error
0 ms0 KiB
#include cstdio> const long long mod = 1000000007; long long t1[1000002],c[1000002]; int main() { int n,k; scanf ("%d %d",&n,&k); t1[1] = 1; for (int i=2;i<=n/2+1;i++) t1[i] = (1 - 1 / i) * t1[i] % mod; //catalan에서 1/n+1부분?? c[0] = 1; for (int i=1;i<=n/2;i++) c[i] = 2*(2 * i - 1) * t1[i+1] % mod * c[i-1] % mod;//전의 c[i-1]에서 곱할 계수? long long u = 1; for (int i=1;i<=n/2;i++){ u = u * k % mod; c[i] = c[i] * u % mod; }//k^n/2부분?? long long res = 1ll; for (int i=0;i<n;i++){ res = res * (k + 1) % mod; if (i % 2 == 0) res = (res - c[i/2]) % mod; } printf ("%lld\n",res); return 0; }

Compilation message (stderr)

R.cpp:1:10: error: #include expects "FILENAME" or <FILENAME>
 #include cstdio>
          ^
R.cpp: In function 'int main()':
R.cpp:9:34: error: 'scanf' was not declared in this scope
     int n,k; scanf ("%d %d",&n,&k);
                                  ^
R.cpp:28:25: error: 'printf' was not declared in this scope
     printf ("%lld\n",res);
                         ^