# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
703219 | rainboy | Modsum (NOI12_modsum) | C11 | 1 ms | 292 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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;
}
Compilation message (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... |