| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 112151 | dolphingarlic | Lun (COCI19_lun) | C++14 | 3 ms | 384 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define FOR(i, x, y) for (ll i = x; i < y; i++)
#pragma GCC optimize("O3")
typedef long long ll;
using namespace std;
int dbl[10] = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
int tot = 0;
bool needs_double = false;
FOR(i, 0, n - 1) {
char x;
cin >> x;
if (x == 'x') {
needs_double = !((n - i) & 1);
} else {
tot += (!((n - i) & 1) ? dbl[x - '0'] : (x - '0'));
}
}
char x;
cin >> x;
if (x == 'x') {
cout << (tot * 9) % 10 << '\n';
} else {
if (needs_double) {
FOR(i, 0, 10) {
if ((tot + dbl[i]) * 9 % 10 == (x - '0')) {
cout << i << '\n';
break;
}
}
} else {
FOR(i, 0, 10) {
if ((tot + i) * 9 % 10 == (x - '0')) {
cout << i << '\n';
break;
}
}
}
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
