救命
查看原帖
救命
701408
lao_wang楼主2023/6/26 21:45

自己测试的数据没错但是只有可怜的35分

代码

#include<bits/stdc++.h>	//可食用头文件
using namespace std ;
long long l , r , T ;
long long temp ;
char s[10000] ;	
int main() {
//	freopen("1.in","r",stdin);
//	freopen("1.out","w",stdout);
	cin >> l >> r >> T ;
	while(T--) {
		cin >> s ;
		if(s[0]=='-'&&(s[1]=='0'||s[1]=='-')||(s[0]=='0'&&strlen(s)>1)||strlen(s)==1&&s[0]=='-') {
			cout << 1 << endl ;
			continue ;
		}
		temp = 0 ;
		for(long long i=strlen(s)-1,j=1; i>=0; i--,j*=10) {
			if(s[i]=='-') continue ;
			temp += (s[i]-'0')*j ;
		}
		if(s[0]=='-') temp = 0-temp ;
		if(temp<l||temp>r||strlen(s)>64&&s[0]!='-'||strlen(s)>63) cout << 2 << endl ;
		else cout << 0 << endl ;
	}
	return 0 ;
}
2023/6/26 21:45
加载中...