# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1259543 | kevinkleindy | Trol (COCI19_trol) | C++20 | 1094 ms | 328 KiB |
#include <bits/stdc++.h>
using namespace std;
int main(){
int q;
cin>>q;
while(q--){
long long l, r;
cin>>l>>r;
long long dist = r-l+1;
long long ans = 0;
while(l%9!=1 && dist>0){
if(l%9 == 0){
ans+=9;
} else {
ans+=l%9;
}
dist--;
l++;
}
if(dist>9){
while(dist>9){
l+=9;
dist-=9;
ans+=45;
}
}
while(dist>0){
if(l%9 == 0){
ans+=9;
} else {
ans+=l%9;
}
dist--;
l++;
}
cout<<ans<<endl;;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |