#蒟蒻萌新求助

B2065 鸡尾酒疗法

输出完一个就执行 `return 0` 了。
by ud2_ @ 2023-04-22 16:30:07


参考一下,如下修正———— 1.将return 0;放在循环外。 2.改变t1,t2更值是俩除数位置。 ``` #include<iostream> using namespace std; int main() { int n,Cocktail[3],other1,other2; double t1,t2; cin >> n; cin >> Cocktail[1] >> Cocktail[2]; t1 = 1.0 * Cocktail[2] / Cocktail[1]; for(int i = 2;i <= n;i++) { cin >> other1 >> other2; t2 = 1.0 * other2 / other1; if(t2 - t1 > 0.05) cout << "better" << endl; else if(t1 - t2 > 0.05) cout << "worse" << endl; else cout << "same" << endl; } return 0; } ```
by cflsfzh @ 2023-04-22 16:35:47


@[cflsfzh](/user/429102) 谢谢!知道了
by _avocado_ @ 2023-04-22 21:46:43


@[ud2_](/user/206953) 知道了,谢谢!
by _avocado_ @ 2023-04-22 21:47:46


|