# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
425438 | errorgorn | Modsum (NOI12_modsum) | C++17 | 78 ms | 332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
using namespace std;
int n,arr[1005][2],k;
void loop(int i,int v){
if (i==n) {
v=(v*v)%5;
k+=(((v+2)*v)%5)+1;
}
else{
for (int x=arr[i][0];x<=arr[i][1];x++){
loop(i+1,(v+x)%5);
}
}
}
int main(){
scanf("%d",&n);
for (int x=0;x<n;x++){
scanf("%d%d",&arr[x][0],&arr[x][1]);
}
loop(0,0);
printf("%d",k);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |