# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
543312 |
2022-03-30T06:48:12 Z |
AlperenT |
Trol (COCI19_trol) |
C++17 |
|
1 ms |
212 KB |
#include <bits/stdc++.h>
using namespace std;
long long t, l, r, ansl, ansr;
void solve(){
cin >> l >> r;
ansl = ((l - 1) / 9) * 45 + (((l - 1) % 9) * ((l - 1) % 9 + 1)) / 2;
ansr = (r / 9) * 45 + ((r % 9) * (r % 9 + 1)) / 2;
cout << ansr - ansl << "\n";
}
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);
cin >> t;
while(t--){
solve();
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |