为啥RE呢
  • 板块灌水区
  • 楼主Nefertari_fly
  • 当前回复0
  • 已保存回复1
  • 发布时间2024/10/23 16:33
  • 上次更新2024/10/23 18:42:04
查看原帖
为啥RE呢
1010982
Nefertari_fly楼主2024/10/23 16:33

rt

#include<bits/stdc++.h>
using namespace std;
int T,l,r,now,cnt=0;
int a[1000005],sum[1000005],s[10005];
int main(){
	while(cnt<=1000000){
		now++;
		for(int i=1;i<=now;i++){
			int x=now,cnt1=0;
			while(x){
				s[++cnt1]=x%10;
				x/=10;
			}
			for(int j=1;j<=cnt1;j++){
				a[++cnt]=s[cnt1-j+1]; 
				if(cnt==1000000)break;
			}
		}
	}
	for(int i=1;i<=cnt;i++){
		sum[i]=sum[i-1]+a[i];
//		cout<<sum[i]<<' ';
	}
	cin>>T;
	while(T--){
		cin>>l>>r;
		cout<<sum[r]-sum[l-1]<<endl;
	}
	return 0;
}


2024/10/23 16:33
加载中...