好像是比例那里算错了但不知道怎么错的,WA了10个
查看原帖
好像是比例那里算错了但不知道怎么错的,WA了10个
240709
woshishuilaizhe楼主2023/12/13 17:25
//B2065 鸡尾酒疗法 
#include<iostream>
using namespace std;
int main()
{
	int n;
	cin >> n;
	double x[n], y[n];
	for(int i=1;i<=n;i++)cin>>x[i]>>y[i];
	for(int i=2; i<=n; i++)
	{
//		cout << 1.0*y[i]/x[i] << " " << 1.0*y[i-1]/x[i-1] << " " << 1.0*y[i]/x[i]-1.0*y[i-1]/x[i-1] << endl;
		if(1.0*y[i]/x[i]-1.0*y[i-1]/x[i-1]>=0.05)cout<<"better"<<endl;
		else if(1.0*y[i-1]/x[i-1]-1.0*y[i]/x[i]>=0.05)cout<<"worse"<<endl;
		else cout<<"same"<<endl;
	}
}
2023/12/13 17:25
加载中...