全TLE求助
查看原帖
全TLE求助
885777
_cheems_ckr_楼主2024/8/19 20:32
#include<bits/stdc++.h>
using namespace std;
int l,r;
bool f(int x){
	for(int y=1;y<=x/2+1;y++){
		for(int z=0;z<=x/2+1;z++){
			if(x==(y+z)*(y-z)){
				return 1;
			}
		}
	}
	return 0;
}
int main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	cin>>l>>r;
	int t=0;
	for(int x=l;x<=r;x++){
		if(f(x)){
			t++;
		}
	}	
	cout<<t;
	return 0;
}

2024/8/19 20:32
加载中...