| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 166127 | itiam | Lun (COCI19_lun) | C++11 | 2 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <algorithm>
#include <string>
#include <sstream>
#include <cstdio>
using namespace std;
int L[100];
int L2[10]={0,5,1,6,2,7,3,8,4,9};
int main(){
int N,par=0,parn=0,y,z;
char x;
cin >> N;
if (N%2==0) parn=1;
for (int i=0;i<N;i++){
cin >> x;
if (x!='x'){
y=2*((int)x-48);
if (y>=10) y=(y%10)+1;
z=(int)x-48;
}
else{
y=-1;
z=-1;
}
if (parn==1){
if ((i+1)%2>0){
L[i]=y;
if (y==-1) par=1;
}
else L[i]=z;
}
else if (parn==0){
if ((i+1)%2==0){
L[i]=y;
if (y==-1) par=1;
}
else L[i]=z;
}
}
int zb=0,zad,br=0,xx;
for (int i=0;i<N-1;i++){
if (L[i]==-1) continue;
zb+=L[i];
}
if (L[N-1]!=-1){
zad=L[N-1];
for (int i=0;i<10;i++){
br=((zb+i)*9)%10;
if (br==zad){
xx=i;
break;
}
}
if (par==1) xx=L2[xx];
}
else{
xx=((zb)*9)%10;
}
cout << xx;
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
