Submission #1113720

#TimeUsernameProblemLanguageResultExecution timeMemory
1113720NipphitchModsum (NOI12_modsum)C++17
25 / 25
29 ms592 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 (now_sum*now_sum*now_sum*now_sum+2*now_sum*now_sum)%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...