답안 #975526

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975526 2024-05-05T12:12:00 Z vjudge1 Trol (COCI19_trol) C++17
0 / 50
1 ms 348 KB
#include <bits/stdc++.h>
using namespace std;

int main(){
	int q;cin>>q;
	int ans[q];
	for(int k=0;k<q;k++){
		int l,r;cin>>l>>r;
		int kanan,kiri;
		int x=(r/9)*9;
		int x45=x*45;
		int cnt1=0;
		for(int i=x+1;i<=r;i++){
			cnt1+=i%9;
		}
		kanan=x45+cnt1;
		
		int cnt2=0;
		x=(l/9)*9;
		x45=x*45;
		for(int i=x+1;i<=l-1;i++){
			cnt2+=i%9;
		}
		kiri=x45+cnt2;
		
		ans[k]=kanan-kiri;
	}
	
	for(int i=0;i<q;i++){
		cout<<ans[i]<<endl;
	}
	
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Incorrect 1 ms 348 KB Output isn't correct
5 Incorrect 0 ms 348 KB Output isn't correct