#include <cstdio>
#include <algorithm>
#include <iostream>
#include <queue>
#include <vector>
#include <map>
#define oo 987654321
using namespace std;
int n, s[1010], e[1010], dt[1010][10], ans = 1;
int main()
{
ios::sync_with_stdio(false);
cin>>n;
for(int i = 1 ; i <= n ; i++ ) cin>>s[i]>>e[i], ans *= (e[i]-s[i]+1);
for(int i = 1 ; i <= n ; i++ )
for(int j = s[i] ; j <= e[i] ; j++ )
{
if( i == 1 ) dt[i][j%5] += 1;
else
{
for(int k = 0 ; k < 5 ; k++ )
dt[i][k] += dt[i-1][(5+(k-(j%5)))%5];
}
}
for(int i = 0 ; i < 5 ; i++ )
ans += ((2*(i*i)+(i*i*i*i))%5)*dt[n][i];
cout<<ans<<endl;
return 0;
}
Compilation message
modsum.c:1:18: fatal error: cstdio: No such file or directory
#include <cstdio>
^
compilation terminated.