@[abc1234shi](/user/941501) ?他用两个循环有错吗
by XuYueming @ 2024-05-20 21:20:40
@[lzy13915136909](/user/1021693) 你先要保存鸡尾酒(第一次输入)的率啊
by TLE_AK @ 2024-05-20 21:20:48
@[abc1234shi](/user/941501) 依旧满江红......
code:
```cpp
#include<bits/stdc++.h>
using namespace std;
int n,a[1005],b[1005];
int main()
{
cin>>n;
for(int i=0;i<n;i++)
{
cin>>a[i]>>b[i];
for(int i=0;i<n;i++)
{
if(a[i]-b[i]>0.05)
cout<<"better"<<endl;
else
{
if(b[i]-a[i]>0.05)
cout<<"worse"<<endl;
else
cout<<"same"<<endl;
}
}
}
return 0;
}
```
by lzy13915136909 @ 2024-05-20 21:21:35
对,先存率,在判断
by March7thDev @ 2024-05-20 21:22:11
@[lzy13915136909](/user/1021693)
你再设两个变量x,y,z,输入x,y。z=x×1.00/y×1.00;这是标准,然后后面的你再设一个变量s,s=a[i]×1.00/b[i]×1.00,将z和s进行比较
by abc1234shi @ 2024-05-20 21:22:14
@[lzy13915136909](/user/1021693)
1.两个循环也可以,否则把i改了
2.应该比较概率,也就是b[i]/a[i]与b[1]/a[1]的差
by TLE_AK @ 2024-05-20 21:23:21
@[abc1234shi](/user/941501) @[红黑树](/user/413140) @[__Doraemon__](/user/1283847) @[XuYueming](/user/728079) @[TLE_AK](/user/788951) 脑子要explode了...... _I do not understand思密达_
by lzy13915136909 @ 2024-05-20 21:24:30
其实我觉得数组没必要
by abc1234shi @ 2024-05-20 21:24:38
@[lzy13915136909](/user/1021693) 你第二个循环不要了
by abc1234shi @ 2024-05-20 21:24:59
@[abc1234shi](/user/941501) 随便吧,反正不卡空间时间(
by TLE_AK @ 2024-05-20 21:25:33