#4是???

B2065 鸡尾酒疗法

你的s=....行无论如何都会得到整数,这样会导致精度损失
by lkrkerry @ 2024-06-08 09:53:59


@[123A123](/user/1235962) 用我的AC代码吧 ``` #include <iostream> using namespace std; int main(){ int x,y,n; cin>>n; cin>>x>>y; double v = y*1.0/x; for(int i = 0;i<n-1;i++){ cin>>x>>y; double temp = y*1.0/x; if(v-temp>0.05) cout<<"worse"<<endl; else if(temp-v>0.05) cout<<"better"<<endl; else cout<<"same"<<endl; } return 0; } ``` 求关,谢谢
by tangyiqi @ 2024-08-12 10:35:33


|