Submission #1113718

#TimeUsernameProblemLanguageResultExecution timeMemory
1113718NipphitchModsum (NOI12_modsum)C++17
5 / 25
6 ms464 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...