lzy13915136909 @ 2024-05-20 21:06:00
本蒟蒻的code......
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,a[1005],b[1005];
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 XuYueming @ 2024-05-20 21:20:40
@abc1234shi ?他用两个循环有错吗
by TLE_AK @ 2024-05-20 21:20:48
@lzy13915136909 你先要保存鸡尾酒(第一次输入)的率啊
by lzy13915136909 @ 2024-05-20 21:21:35
@abc1234shi 依旧满江红......
code:
#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 March7thDev @ 2024-05-20 21:22:11
对,先存率,在判断
by abc1234shi @ 2024-05-20 21:22:14
@lzy13915136909 你再设两个变量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 TLE_AK @ 2024-05-20 21:23:21
@lzy13915136909 1.两个循环也可以,否则把i改了 2.应该比较概率,也就是b[i]/a[i]与b[1]/a[1]的差
by lzy13915136909 @ 2024-05-20 21:24:30
@abc1234shi @红黑树 @Doraemon @XuYueming @TLE_AK 脑子要explode了...... I do not understand思密达
by abc1234shi @ 2024-05-20 21:24:38
其实我觉得数组没必要
by abc1234shi @ 2024-05-20 21:24:59
@lzy13915136909 你第二个循环不要了
by TLE_AK @ 2024-05-20 21:25:33
@abc1234shi 随便吧,反正不卡空间时间(