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<cstdio>
long long a[1000000],an;
void backtracking(long long i,int j)
{
if(j==0)a[an++]=i;
else
{
backtracking(i*10+3,j-1);
backtracking(i*10+5,j-1);
backtracking(i*10+8,j-1);
}
}
int main()
{
long long x,y,before=0,res=0;
int i;
for(i=1;i<=11;i++)backtracking(0,i);
scanf("%lld%lld",&x,&y);
for(i=0;i<an;i++)
{
if(a[i]>=x&&a[i]<=y)
{
res+=before%19980305*a[i]%19980305;
res%=19980305;
before=a[i];
}
}
printf("%lld",res);
}
# | 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... |