Jason_HJS_ @ 2023-08-09 19:03:24
/*****************************************
备注:
******************************************/
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 1e5 + 10;
const int INF = 0x3f3f3f3f;
signed main()
{
int n;
cin>>n;
int x,y;
int a,b;
cin>>a>>b;
double ji=b*100.0/a;
// cout<<ji<<endl;
for(int i=1;i<=n-1;i++)
{
cin>>x>>y;
double xin=y*100.0/x;
// cout<<fixed<<setprecision(3)<<xin<<endl;
if(ji>=xin)
{
if(ji-xin<=0.5)
{
cout<<"same\n";
// cout<<ji-xin<<endl;
}
else if(ji-xin>0.5)
{
cout<<"worse\n";
// cout<<ji-xin<<endl;
}
}
else
{
if(xin-ji<=0.5)
{
cout<<"same\n";
// cout<<xin-ji<<endl;
}
else if(xin-ji>0.5)
{
cout<<"better\n";
// cout<<xin-ji<<endl;
}
}
}
return 0;
}
by sandwich03 @ 2023-08-09 19:10:57
@HJS 你题目理解错了。应该每组数据都有一个旧的
by sandwich03 @ 2023-08-09 19:12:17
不对,当我没说
by sandwich03 @ 2023-08-09 19:14:17
应该是xy输反了
by sandwich03 @ 2023-08-09 19:15:14
应该是double xin=x*100.0/y;
by sandwich03 @ 2023-08-09 21:18:27
@HJS 你可以当我上面没说,因为我说错了,但你乘了100.0?你确定?代码改后如下:(能AC)
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin>>n;
double x,y;
double a,b;
cin>>a>>b;
double ji=b/a;
for(int i=1;i<=n-1;i++)
{
cin>>x>>y;
double xin=y/x;
if(ji>=xin)
{
if(ji-xin<=0.05)
{
cout<<"same\n";
}
else if(ji-xin>0.05)
{
cout<<"worse\n";
}
}
else
{
if(xin-ji<=0.05)
{
cout<<"same\n";
}
else if(xin-ji>0.05)
{
cout<<"better\n";
}
}
}
return 0;
}
by sandwich03 @ 2023-08-09 21:19:05
求关注
by Jason_HJS_ @ 2023-08-10 18:48:45
感谢大佬@linzhi123 已通过
给了关注
by Jason_HJS_ @ 2023-08-10 18:49:13
求互关
by sandwich03 @ 2023-08-10 21:44:52
好的 @HJS