답안 #975270

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
975270 2024-05-04T16:25:59 Z vjudge1 Trol (COCI19_trol) C++17
0 / 50
1 ms 348 KB
#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;
		if(l==r) cout<<l%9<<"\n";
		else {	
			int m=l%9;
			int p=9-m+1;
			double sum1=((double)p/(double)2)*(m+9);
			int o=l+9-m;
			int k=r-o; 
			int a;
			if(l==1)a=k/9-1;
			else a=k/9; 
			int sum2=(9*(10)/2)*a;
			int res=r%9;
			int sum3=res*(res+1)/2;
			cout<<sum1+sum2+sum3<<"\n";
		}
	}
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Incorrect 1 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 1 ms 348 KB Output isn't correct