Submission #976971

# Submission time Handle Problem Language Result Execution time Memory
976971 2024-05-07T09:51:28 Z vjudge1 Trol (COCI19_trol) C++17
50 / 50
1 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
#define bismillah ios_base::sync_with_stdio(0), cin.tie(NULL), cout.tie(NULL);
#define int long long

signed main(){
	bismillah
	int q;
	cin >> q;
	int l, r;
	for(int i=0; i<q; i++){
		cin >> l >> r;
		int jarak = r-l+1;
		int ans=jarak/9*45;
		for(int j=1; j<=jarak%9; j++){
			if(l%9==0){
				ans+=9;
			}else{
				ans += l%9;
			}
			l++;
		}
		cout << ans << endl;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct