Submission #172982

# Submission time Handle Problem Language Result Execution time Memory
172982 2020-01-02T22:17:35 Z Doda Lun (COCI19_lun) C++14
40 / 50
2 ms 380 KB
#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>

using namespace std;

int n,zr;
string s;

int main () {
ios_base::sync_with_stdio(false);
cin.tie(NULL);

cin >> n >> s;

for (int i = n-2;i>=0;i-=2){
	if (s[i] == 'x')
		i-=2;
	int broj = int (s[i]) - 48;
	broj *= 2;
	int zbroj = 0;
	int r = broj;
	while (r != 0){
		zbroj += r%10;
		r /= 10;
	}
	broj = zbroj;
	zbroj = 10;
	while (zbroj >= 10){
		zbroj = broj%10 + broj/10;
		broj = zbroj;
	}
	
	s[i] =broj+48;
//	cout << s[i] << endl;
}

for (int i = 0;i<n;i++)
	if (s[i] != 'x')
		zr += int (s[i] - 48);
	

cout << zr*9%10;



return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Incorrect 2 ms 380 KB Output isn't correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Incorrect 2 ms 376 KB Output isn't correct
10 Correct 2 ms 376 KB Output is correct