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