求调!!
查看原帖
求调!!
1305753
zheng_haotian楼主2025/7/31 19:05

错误的数据点是应该输出y但是我输出了n

#include <bits/stdc++.h>
using namespace std;
int s,x;
int main(){
    cin>>s>>x;
    double v=7;
    double l=0;
    for(int i=1;i<=s-x;++i){
        l+=v;
        v=0.98*v;
        
    }
    if(s-x<0){
        if(v+0.98*v<=x){
            cout<<'y'<<endl;
        }else{
            cout<<'n'<<endl;
        }
        return 0;
    }
    if(l-x+s+v<=2*x){
        cout<<'y'<<endl;
    }else{
        cout<<'n'<<endl;
    }
}

不知道是哪个条件漏掉了

2025/7/31 19:05
加载中...