| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 224942 | VEGAnn | Lun (COCI19_lun) | C++14 | 6 ms | 512 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define all(x) x.begin(),x.end()
using namespace std;
int n, vl[10] = {0, 2, 4, 6, 8, 1, 3, 5, 7, 9}, loc;
string s;
bool ok(){
int sm = 0;
for (int i = 1; i < n; i++)
if (i & 1){
sm += vl[s[i] - '0'];
} else {
sm += s[i] - '0';
}
return ((sm * 9) % 10) == (s[0] - '0');
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
cin >> n >> s;
reverse(all(s));
loc = s.find('x');
for (int dg = 0; dg < 10; dg++) {
s[loc] = char(dg + '0');
if (ok()){
cout << dg;
return 0;
}
}
return -1;
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
