# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
147111 | 44442 | Lun (COCI19_lun) | C++11 | 3 ms | 504 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
long long n,o,b,z[104],c,d,g,e,f;
char a[104];
int main (){
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin>>n;
for(int i=n;i>0;i--){
cin>>a[i];
if(a[i]==120){
z[i]=1;
o=i;
}
}
for(int i=2;i<n+1;i=i+2){
if(!z[i]){
g=2*a[i]-96;
if(g>9)
g=g%10+1;
b=b+g;
}
}
for(int i=3;i<n+1;i=i+2){
if(!z[i])
b=b+a[i]-48;
}
if(o!=1){
c=b%10;
d=10-((a[1]-48)%10);
if(d>=c)
e=d-c;
else
e=10-(c-d);
if(!o%2)
cout<<e/2;
else
cout<<e;
}
else
cout<<(b*9)%10;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |