제출 #975302

#제출 시각아이디문제언어결과실행 시간메모리
975302vjudge1Trol (COCI19_trol)C++17
50 / 50
1 ms516 KiB
#include<bits/stdc++.h>
#define pii pair<int,int>
#define fi first
#define se second
#define int long long
using namespace std;
const int maxn=1e5+5;
signed main() {
	int q; cin>>q;
	while(q--) {
		int l,r; cin>>l>>r;
		int k=(r/9)*45;
		int mk=((r%9)*((r%9)+1))/2;
		int j=((l-1)/9)*45;
		int mj=(((l-1)%9)*(((l-1)%9)+1))/2;
		cout<<(k+mk)-(j+mj)<<"\n";
	}
}
#Verdict Execution timeMemoryGrader output
Fetching results...