满江红QAQ

B2065 鸡尾酒疗法

数组别在幂里定啊
by abc1234shi @ 2024-05-20 21:09:56


@[lzy13915136909](/user/1021693) 是有效“率”哦,不是个数。
by 红黑树 @ 2024-05-20 21:10:15


@[abc1234shi](/user/941501) 数组在 main 里有啥问题吗?
by 红黑树 @ 2024-05-20 21:10:58


@[红黑树](/user/413140) 不然数组里会有随机数
by abc1234shi @ 2024-05-20 21:12:01


@[abc1234shi](/user/941501) 但是他会用读入冲掉。
by 红黑树 @ 2024-05-20 21:13:45


@[lzy13915136909](/user/1021693) 1.你应该是输入完一个就输出一个答案。2.是效率差而不是两个数的差
by abc1234shi @ 2024-05-20 21:15:26


```cpp #include <iostream> using namespace std; int main() { int n, a[30][2]; double x, y; cin >> n; for (int i = 0; i < n; i++) cin >> a[i][0] >> a[i][1]; x = 1.0 * a[0][1] / a[0][0]; for (int i = 1; i < n; i++) { y = 1.0 * a[i][1] / a[i][0]; if (y - x > 0.05) cout << "better" << endl; else if (x - y > 0.05) cout << "worse" << endl; else cout << "same" << endl; } return 0; } ```
by March7thDev @ 2024-05-20 21:17:27


@[abc1234shi](/user/941501) @[红黑树](/user/413140) ,还是没懂...... 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:17:52


同样六年级qaq
by March7thDev @ 2024-05-20 21:18:00


@[lzy13915136909](/user/1021693) 你第二个循环不要了,加到第一个循环里
by abc1234shi @ 2024-05-20 21:19:11


| 下一页