# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
172985 | Doda | Lun (COCI19_lun) | C++14 | 2 ms | 380 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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 = 10;
int r = broj;
while (broj >= 10){
zbroj += r%10;
broj = zbroj;
r /= 10;
if (r == 0){
r = zbroj;
broj = r;
zbroj = 0;
}
}
// 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 |
---|---|---|---|---|
Fetching results... |