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 <iostream>
using namespace std;
typedef long long ll;
const int MAXN = 1007;
ll n, ans = 0;
ll a[MAXN], b[MAXN];
void rec(ll ind, ll temp){
if(ind == n)
ans += (temp*temp*temp*temp + 2*temp*temp) % 5 + 1;
for(ll i = a[ind]; i <= b[ind]; i++)
rec(ind+1, temp+i);
}
int main()
{
cin >> n;
for(int i = 0; i < n; i++)
cin >> a[i] >> b[i];
rec(0, 0);
cout << ans << endl;
}
# | 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... |