#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
string s;
cin >>n>>s;
long long sum = 0;
for (int i = 0; i < n; ++i) {
if (i % 2 == 1 and s[i] != 'x') {
long long k = (s[i] - '0') * 2;
if (k > 9) {
sum += (1 + k % 10);
}
else {
sum += k;
}
}
else {
if (s[i] != 'x') {
sum += (s[i] - '0');
}
}
}
long long res = (sum * 9) % 10;
cout <<res<<endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
6 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
7 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
8 |
Correct |
1 ms |
364 KB |
Output is correct |
9 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
10 |
Correct |
1 ms |
364 KB |
Output is correct |