# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
703219 | rainboy | 나머지들의 합 (NOI12_modsum) | C11 | 1 ms | 292 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
#include <string.h>
#define M 5
int main() {
static int dp[M], dq[M];
int n, a, b, c, ans;
scanf("%d", &n);
dp[0] = 1;
while (n--) {
int l, r;
scanf("%d%d", &l, &r);
memset(dq, 0, M * sizeof *dq);
for (a = 0; a < M; a++)
for (b = 0; b < M; b++) {
c = (a + b) % M;
dq[c] += dp[a] * ((r + M - b) / M - (l - 1 + M - b) / M);
}
memcpy(dp, dq, M * sizeof *dq);
}
ans = 0;
for (a = 0; a < M; a++)
ans += dp[a] * ((a * a * a * a + a * a * 2) % M + 1);
printf("%d\n", ans);
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |