# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1254322 | warrenn | Trol (COCI19_trol) | C++20 | 0 ms | 328 KiB |
#include<bits/stdc++.h>
using namespace std;
#define int long long
int com(int a){
int hah=a%9;
if(hah==0)hah=9;
return hah;
}
signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);cout.tie(0);
int qu;
cin>>qu;
while(qu--){
int l,r;
cin>>l>>r;
int fir=com(l);
int sec=com(r);
int full=(r-l+1)/9;
int sisa=(r-l+1)-full*9;
int ans=full*45;
for(int q=1;q<=sisa;q++){
ans+=com(r-q+1);
}
cout<<ans<<endl;
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |