# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
104090 | wiritos1 | Lun (COCI19_lun) | C++98 | 3 ms | 512 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;
int tem;
tem=b[a-1]-'0';
tem=10-tem;
bool p2=false;
int sum=0;
for(int c=0;c<a;c++)
{
if(b[c]=='x')
{
if(a%2==0)
{
p2=false;
}
else
{
p2=true;
}
}
else
{
if(a%2==0)
{
sum+=b[c]-'0';
}
else
{
if(b[c]<'5')
{
sum+=b[c]-'0';
}
else
{
sum+=((b[c]-'5')*2)+1;
}
}
}
}
sum%=10;
tem+=10;
tem-=sum;
tem%=10; //num a obtener
if(tem%2==0)
{
tem/=2;
}
else
{
tem--;
tem/=2;
tem+=5;
}
cout<<tem;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |