You are viewing a single comment's thread. Return to all comments →
Here's my code in C++. there's no need to use arrays. I hope you find it useful.
int main() { int n,m; cin >> n >> m; int a,b; long long k,result = 0; while(m--) { cin >> a >> b >> k; result += (b-a+1)*k; } cout << result/n << endl; return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Filling Jars
You are viewing a single comment's thread. Return to all comments →
Here's my code in C++. there's no need to use arrays. I hope you find it useful.