# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
975485 | vjudge1 | Trol (COCI19_trol) | C++17 | 1 ms | 604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#define fast ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);
#define nl "\n"
#define ll long long
#define str string
#define dl double
#define ts(val) to_string(val)
#define ti(val) stoi(val)
#define ft first
#define sc second
#define Pb push_back
#define pB pop_back
#define mp make_pair
#define mst(array,value) memset(array,value,sizeof(array))
#define gtr greater<int>()
#define all(ar) ar.begin(),ar.end()
using namespace std;
#define ull unsigned long long int
//#define int long long
ull sum[] = {9,1,2,3,4,5,6,7,8};
signed main() {
//fast
//cout << (ll)pow(2,60);
//1152921504606846976
int t; cin >> t;
while(t--) {
ull a,b; cin >> a >> b;
ull x = a%9, y = b%9;
//cout << x << " " << y << nl;
ull z = (b-a)/9;
//cout << z << nl;
ull ans = z*45;
//cout << ans << nl;
if(x > y) {
for(int i=x;i<=8;i++) ans += sum[i];
for(int i=0;i<=y;i++) ans += sum[i];
} else {
for(int i=x;i<=y;i++) ans += sum[i];
}
cout << ans << nl;
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |