| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 103573 | kuko | Lun (COCI19_lun) | C++11 | 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>
using namespace std;
char account[128];
int main()
{
	int n, d, sum = 0;
	cin >> n;
	cin >> account;
	
	int multiplier = 1;
	for( int i = n - 2; i >= 0; i -= 2 )
	{
		if( account[i] == 'x' )
		{
			multiplier = 2;
			continue;
		}
		d = account[i] - '0';
		d *= 2;
		d = d%10 + d/10;
		account[i] = d + '0';
	}
	for( int i = 0; i < n - 1; i++ )
		if( account[i] != 'x' )
			sum += account[i] - '0';
	int newsum = 0, lastdigit = account[n - 1] - '0';
	if( account[n - 1] != 'x' )
	{
		for( int k = 0; k < 10; k++ )
		{
			newsum = sum + (k*multiplier)%10 + (k*multiplier)/10;
			if( (newsum * 9) % 10 == lastdigit )
			{
				cout << k;
				return 0;
			}
		}
	}
	else
	{
		for( int k = 0; k < 10; k++ )
			if( (sum * 9) % 10 == k )
			{
				cout << k;
				return 0;
			}
	}
	return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
