# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
258064 | 2020-08-05T09:46:50 Z | itiam | Trol (COCI19_trol) | C++11 | 1 ms | 256 KB |
#include <bits/stdc++.h> using namespace std; int main(){ long long Q,r,l,ost,sl,sr,s; cin >> Q; for (int k=0;k<Q;k++){ s=0;sl=0;sr=0; cin >> r >> l; r-=1; sl=(l/9)*45; for (int i=l%9;i>0;i--){ sl+=i;} sr=(r/9)*45; for (int i=r%9;i>0;i--){ sr+=i;} s=sl-sr; cout << s << endl; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |