Submission #4558

#TimeUsernameProblemLanguageResultExecution timeMemory
4558gs13068Modsum (NOI12_modsum)C++98
25 / 25
0 ms1108 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...