# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
976087 |
2024-05-06T07:21:16 Z |
vjudge1 |
Trol (COCI19_trol) |
C++17 |
|
1 ms |
348 KB |
#include <bits/stdc++.h>
using namespace std;
#define ios ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define ll long long
// 1-9=45
// 1-18=90
ll l,r;
ll solve(ll n){
ll count,x,idx,sum=0;
idx=n%9+1;
while(idx--)sum+=idx;
count=n/9;
x= 45*count+sum;
return x;
}
int main(){
ios
ll t; cin >> t;
while (t--){
cin >> l >> r;
cout << solve(r)-solve(l-1) << endl;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |