Submission #10363

# Submission time Handle Problem Language Result Execution time Memory
10363 2014-10-20T01:42:25 Z gs14004 Modsum (NOI12_modsum) C++
25 / 25
72 ms 1096 KB
#include <cstdio>

int n,s[1005], e[1005];

int get_cnt(long long x, int y){
    if(y == n){
        x = x*x +1;
        return (x*x+4)%5+1;
    }
    else{
        int res = 0;
        for (int i=s[y]; i<=e[y]; i++) {
            res += get_cnt(x+i,y+1);
        }
        return res;
    }
}

int main(){
    scanf("%d",&n);
    for (int i=0; i<n; i++) {
        scanf("%d %d",&s[i],&e[i]);
    }
    printf("%d",get_cnt(0,0));
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1096 KB Output is correct
2 Correct 0 ms 1096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1096 KB Output is correct
2 Correct 0 ms 1096 KB Output is correct
3 Correct 0 ms 1096 KB Output is correct
4 Correct 0 ms 1096 KB Output is correct
5 Correct 0 ms 1096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1096 KB Output is correct
2 Correct 0 ms 1096 KB Output is correct
3 Correct 0 ms 1096 KB Output is correct
4 Correct 0 ms 1096 KB Output is correct
5 Correct 0 ms 1096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 1096 KB Output is correct
2 Correct 0 ms 1096 KB Output is correct
3 Correct 0 ms 1096 KB Output is correct
4 Correct 0 ms 1096 KB Output is correct
5 Correct 4 ms 1096 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 1096 KB Output is correct
2 Correct 0 ms 1096 KB Output is correct
3 Correct 20 ms 1096 KB Output is correct
4 Correct 0 ms 1096 KB Output is correct
5 Correct 72 ms 1096 KB Output is correct