제출 #456155

#제출 시각아이디문제언어결과실행 시간메모리
456155JasiekstrzTrol (COCI19_trol)C++17
50 / 50
1 ms316 KiB
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
long long f(long long x)
{
	long long d=x/9,r=x%9;
	return d*45+r*(r+1)/2;
}
void solve()
{
	long long l,r;
	cin>>l>>r;
	cout<<f(r)-f(l-1)<<"\n";
	return;
}
int main()
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int qq;
	cin>>qq;
	while(qq--)
		solve();
	return 0;
}

#Verdict Execution timeMemoryGrader output
Fetching results...