uva 573 - The Snail

很简单,不过还是wa了几次,才做对

uva 573 - The Snail
#include<iostream>
using namespace std;
int main(){

    int h,speed,slide,per;
    while(cin>>h>>speed>>slide>>per){
        if(!h&&!speed&&!slide&&!per)
            break;
        h*=100;
        speed*=100;
        slide*=100;
        int d=speed*per/100;
        int height=0;
    
        for(int i=0;;i++){

            if(speed<=0)
                speed=0;
            height+=speed;
            if(height>h){
                cout<<"success on day "<<i+1<<endl;

                break;
            }
            height-=slide;
            if(height<0){
                cout<<"failure on day "<<i+1<<endl;
                break;
            }
            speed-=d;
        }
    }
}
uva 573 - The Snail

uva 573 - The Snail

上一篇:linux系统创建新LV,挂载新分区。


下一篇:将 DbMigrationsConfiguration.AutomaticMigrationsEnabled 设置为 true 以启用自动迁移