| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 112151 | dolphingarlic | Lun (COCI19_lun) | C++14 | 3 ms | 384 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 <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... | ||||
