# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
971284 |
2024-04-28T10:47:57 Z |
vjudge1 |
Trol (COCI19_trol) |
C++17 |
|
1 ms |
348 KB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
int q;
cin>>q;
while(q--){
int l,r;
cin>>l>>r;
int kali=(r-l+1)/9;
int sisa=(r-l+1)-(kali*9);
int mulai=l%9;
if(mulai==0){
mulai=9;
}
int ans=kali*45;
for(int k=1;k<=sisa;k++){
ans+=mulai;
mulai++;
if(mulai>9){
mulai=1;
}
}
cout<<ans<<'\n';
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
348 KB |
Output is correct |
5 |
Correct |
1 ms |
344 KB |
Output is correct |