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 <bits/stdc++.h>
using namespace std;
//#define int long long
const int N=1005;
int n,v[N],w[N];
int slove(int now,int now_sum){
if(now==n) return int(pow(now_sum,4)+2*pow(now_sum,2))%5+1;
int res=0;
for(int i=v[now+1];i<=w[now+1];i++){
res+=slove(now+1,now_sum+i);
}
return res;
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i=1;i<=n;i++) cin >> v[i] >> w[i];
cout << slove(0,0);
}
# | 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... |