# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
479384 | rainboy | Lun (COCI19_lun) | C11 | 1 ms | 280 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>
#define N 100
int f(int d) {
return d < 5 ? d * 2 : (d - 5) * 2 + 1;
}
int g(int d) {
return d % 2 == 0 ? d / 2 : d / 2 + 5;
}
int main() {
static char cc[N + 1];
int n, i, i_, d;
scanf("%d%s", &n, cc);
d = 0, i_ = -1;
for (i = n - 1; i >= 0; i--)
if (cc[i] != 'x')
d = (d + ((n - i) % 2 == 0 ? f(cc[i] - '0') : cc[i] - '0')) % 10;
else
i_ = i;
d = (10 - d) % 10;
if ((n - i_) % 2 == 0)
d = g(d);
printf("%d\n", d);
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |