#include <bits/stdc++.h>
using namespace std;
long N;
vector<long> x;
long inp;
long sum;
void p(long n, long s){
if (n == 0){
sum += (((s * s * s * s) + (2 * s * s)) % 5) + 1;
return;
}
for (long i = x[(2 * n) - 2]; i <= x[(2 * n) - 1]; i++){
long ls = s;
ls += i;
p(n - 1, ls);
}
return;
}
int main() {
cin >> N;
sum = 0;
for (long i = 0; i < 2 * N; i++){
cin >> inp;
x.push_back(inp);
}
p(N, 0);
cout << sum;
}
# | 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... |