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>
int d[1001][5];
int main()
{
int i,j,k,n,a,b;
scanf("%d",&n);
d[0][0]=1;
for(i=1;i<=n;i++)
{
scanf("%d%d",&a,&b);
for(j=a;j<=b;j++)for(k=0;k<5;k++)d[i][k]+=d[i-1][(k+5-j%5)%5];
}
i=0;
for(k=0;k<5;k++)i+=d[n][k]*((k*k*k*k+2*k*k)%5+1);
printf("%d",i);
}
# | 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... |