제출 #490930

#제출 시각아이디문제언어결과실행 시간메모리
490930rainboyLjetopica (COI19_ljetopica)C11
25 / 100
0 ms292 KiB
#include <stdio.h> #include <string.h> #define N 1000 #define MD 1000000007 int pp2[N + 1], vv[N + 1], ff[N + 1], gg[N + 1]; void init() { int i; pp2[0] = 1; for (i = 1; i <= N; i++) pp2[i] = pp2[i - 1] * 2 % MD; ff[0] = gg[0] = 1; for (i = 1; i <= N; i++) { vv[i] = i == 1 ? 1 : (long long) vv[i - MD % i] * (MD / i + 1) % MD; ff[i] = (long long) ff[i - 1] * i % MD; gg[i] = (long long) gg[i - 1] * vv[i] % MD; } } int choose(int n, int k) { return (long long) ff[n] * gg[k] % MD * gg[n - k] % MD; } int main() { static char cc[N + 1], aa[N + 1], bb[N + 1]; int n, k, i, x; init(); scanf("%d%d%s%s%s", &n, &k, cc, aa, bb); if (k == 0 && strcmp(aa, bb) == 0) { x = 0; for (i = 0; i < n; i++) x = (x * 2 + aa[i] - '0') % MD; printf("%d\n", x); return 0; } printf("%lld\n", (long long) (pp2[n - 1] + pp2[n] - 1) % MD * choose(n - 1, k) % MD); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

ljetopica.c: In function 'main':
ljetopica.c:32:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   32 |  scanf("%d%d%s%s%s", &n, &k, cc, aa, bb);
      |  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...