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<stdio.h>
int x,y;
int num[8];
int NumTo()
{
int n=0,i,j=1;
for(i=0;num[i]!=0;i++,j*=10)
{
n=n+j*num[i];
}
return n;
}
void add2(int idx)
{
if(num[idx]==8)
{
num[idx]=3;
add2(idx+1);
}
else if(num[idx]==5)num[idx]=8;
else if(num[idx]==3)num[idx]=5;
else if(num[idx]==0)num[idx]=3;
}
void add()
{
add2(0);
}
int main()
{
int i=0,a,b=0;
long long int s=0;
scanf("%d %d",&x,&y);
a=x;
for(;x;x/=10)
{
num[i++]=x%10;
}
i=0;
for(;b!=y;)
{
add();
b=NumTo();
s=(s+(long long int)a*b)%19980305;
a=b;
}
printf("%lld",s);
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |