#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);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1108 KB |
Output is correct |
2 |
Correct |
0 ms |
1108 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1108 KB |
Output is correct |
2 |
Correct |
0 ms |
1108 KB |
Output is correct |
3 |
Correct |
0 ms |
1108 KB |
Output is correct |
4 |
Correct |
0 ms |
1108 KB |
Output is correct |
5 |
Correct |
0 ms |
1108 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1108 KB |
Output is correct |
2 |
Correct |
0 ms |
1108 KB |
Output is correct |
3 |
Correct |
0 ms |
1108 KB |
Output is correct |
4 |
Correct |
0 ms |
1108 KB |
Output is correct |
5 |
Correct |
0 ms |
1108 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1108 KB |
Output is correct |
2 |
Correct |
0 ms |
1108 KB |
Output is correct |
3 |
Correct |
0 ms |
1108 KB |
Output is correct |
4 |
Correct |
0 ms |
1108 KB |
Output is correct |
5 |
Correct |
0 ms |
1108 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
1108 KB |
Output is correct |
2 |
Correct |
0 ms |
1108 KB |
Output is correct |
3 |
Correct |
0 ms |
1108 KB |
Output is correct |
4 |
Correct |
0 ms |
1108 KB |
Output is correct |
5 |
Correct |
0 ms |
1108 KB |
Output is correct |