Submission #26799

# Submission time Handle Problem Language Result Execution time Memory
26799 2017-07-06T05:03:20 Z sutekine Modsum (NOI12_modsum) C++11
0 / 25
0 ms 2228 KB
#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;

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;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2228 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 2228 KB Output isn't correct
2 Halted 0 ms 0 KB -