# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
823843 | Sandarach151 | Trol (COCI19_trol) | C++17 | 1 ms | 316 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
long long func(long long x){
if(x%9==0){
return 9;
}
else{
return x%9;
}
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
long long t;
cin >> t;
while(t--){
long long a, b;
cin >> a >> b;
long long ans = 0;
while(a%9!=1 && a<=b){
ans+=func(a);
a++;
}
while(b%9!=0 && b>=a){
ans+=func(b);
b--;
}
ans+=5*(b-a+1);
cout << ans << '\n';
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |