# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
104100 | wiritos1 | Lun (COCI19_lun) | C++98 | 2 ms | 384 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;
int main()
{
int a;
string b;
cin>>a>>b;
bool p2=false;
int sum=0;
for(int c=0;c<a-1;c++)
{
if(b[c]=='x')
{
if(c%2==(a-1)%2)
{
p2=false;
}
else
{
p2=true;
}
}
else
{
if(c%2==(a-1)%2)
{
sum+=b[c]-'0';
}
else
{
if(b[c]<'5')
{
sum+=(b[c]-'0')*2;
}
else
{
sum+=((b[c]-'5')*2)+1;
}
}
}
//cout<<sum<<" ";
}
int temi;
//cout<<sum<<"s"<<'\n';
for(int ga=0;ga<=9;ga++)
{
if(p2)
{
temi=ga*2;
if(temi>=10)
{
temi%=10;
temi++;
}
}
else
{
temi=ga;
}
//cout<<temi<<" ";
temi+=sum;
temi*=9;
temi%=10;
//cout<<temi<<" "<<b[a-1]<<'\n';
if(b[a-1]=='x')
{
if((sum*9)%10==ga)
{
cout<<ga;
return 0;
}
}
else
{
if(temi==b[a-1]-'0')
{
cout<<ga;
return 0;
}
}
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |