hdu_1049_水_模擬

傳送門:http://acm.hdu.edu.cn/showproblem.php?pid=1049

和貪心沒有任何關係,很簡單的模擬題:

#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn=1000;

int main(void)
{
    int n,d,u;
    int i,j,k;
    while(cin>>n>>u>>d)
    {
        if(n==0&&u==0&&d==0) break;
        int s=0;
        int step=u-d;
        int time=(n-u)/step;
        if((n-u)%step!=0) time++;  //恰好能被整除
        time=time*2+1;
        cout<<time<<endl;

    }
}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章