哪里出错了呀

B2065 鸡尾酒疗法

``` #include <stdio.h> int main(void) { int n,x,y; double k,a[20][2],h; scanf("%d",&n); for(x=0;x<n;x++) { for(y=0;y<2;y++) { scanf("%d",&a[x][y]); } } k=a[0][1]/a[0][0]; for(x=1;x<n;x++) { h=a[x][1]/a[x][0]; if((h-k)>0.05) printf("better\n"); else if((k-h)>0.05) printf("worse\n"); else printf("same\n"); } return 0; ``` 我看一下
by qleizhengye2022 @ 2023-12-13 22:40:58


```cpp #include <stdio.h> int main(void) { int n,x,y; double k,a[20][2],h; scanf("%d",&n); for(x=0;x<n;x++) for(y=0;y<2;y++) scanf("%d",&a[x][y]); k=a[0][1]/a[0][0]; for(x=1;x<n;x++) { h=a[x][1]/a[x][0]; if((h-k)>0.05) printf("better\n"); else if((k-h)>0.05) printf("worse\n"); else printf("same\n"); } return 0; } ``` 把程序改了一下,建议到学术版看一下,本人技术不太高明,请谅解,谢谢
by qleizhengye2022 @ 2023-12-13 22:45:11


``` #include<bits/stdc++.h> using namespace std; int main() { int n,a,b,x,y; double jw,ot; cin>>n; cin>>a>>b; jw=(double)b/a; for(int i=1; i<=n-1; i++) { cin>>x>>y; ot=(double)y/x; if(ot-jw>=0.05) cout<<"better"<<endl; else if(jw-ot>0.05) cout<<"worse"<<endl; else cout<<"same"<<endl; } return 0; } 来了噢
by 805912cpy @ 2023-12-17 15:56:28


|