Submission #4558

# Submission time Handle Problem Language Result Execution time Memory
4558 2013-10-31T14:28:22 Z gs13068 Modsum (NOI12_modsum) C++
25 / 25
0 ms 1108 KB
#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
1 Correct 0 ms 1108 KB Output is correct
2 Correct 0 ms 1108 KB Output is correct
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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