一本通网站90分求助
查看原帖
一本通网站90分求助
1649222
O_O6楼主2025/1/27 11:19

在一本通里第五个测试点一直错啊QAQ实在找不到错了,麻烦各位有一本通账号的大佬救救孩子吧QAQ

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

int n;
int a,b;
double x,y;

int main(){
	cin>>n;
	cin>>a>>b;
	x = (double)b/a;
	for(int i = 2;i<=n;i++){
		cin>>a>>b;
		y = (double)b/a;
		if((y-x) > 0.05) cout<<"better"<<endl;
		else{
			if((y-x) < -0.05) cout<<"worse"<<endl;
			else cout<<"same"<<endl;
		}
	}
	return 0;
}

PS:在一本通上没对,但在洛谷AC了🌚

2025/1/27 11:19
加载中...