数据问题
查看原帖
数据问题
1104615
N_ty楼主2023/12/3 17:18

为什么5号数据点0.0输入什么都能对? 比如这个

#include<bits/stdc++.h>
using namespace std;

#define ll long long


int main()
{
	double s;
	cin>>s;
	s*=pow(10,8);
	ll e=s,S;
	int ans=0;
	if(s==0){
		cout<<"-1e8";
		return 0;
	}
	for (int i=0;i<=100;i++) 
		for (int j=0;j<=100;j++) 
			for (int k=0;k<=100;k++) 
				for (int l=0;l<=100;l++){
					S=(100-i)*(100-j)*(100-k)*(100-l);
					if (S==e) ans++;
				}
	cout<<ans;
	return 0;
}

他和

#include<bits/stdc++.h>
using namespace std;

#define ll long long


int main()
{
	double s;
	cin>>s;
	s*=pow(10,8);
	ll e=s,S;
	int ans=0;
	if(s==0){
		cout<<"1";
		return 0;
	}
	for (int i=0;i<=100;i++) 
		for (int j=0;j<=100;j++) 
			for (int k=0;k<=100;k++) 
				for (int l=0;l<=100;l++){
					S=(100-i)*(100-j)*(100-k)*(100-l);
					if (S==e) ans++;
				}
	cout<<ans;
	return 0;
}

的效果是一样的,请求修改

@ 小粉兔

2023/12/3 17:18
加载中...