当前位置:编程学习 > C/C++ >>

杭电1049

#include <stdio.h>
int main (void)
{
    int n,u,d,i,s;
    while(scanf("%d%d%d",&n,&u,&d)!=EOF&&n)
    {
        s=0;
        if((n-u)%(u-d)==0)
        printf("%d\n",(n-u)/(u-d)*2+1);
        else
        if(n-(n-u)/(u-d)*(u-d)>u)
        printf("%d\n",((n-u)/(u-d))*2+3);
        else
        if(n-(n-u)/(u-d)*(u-d)==u)
        printf("%d\n",((n-u)/(u-d))*2+1);
    }
    return 0;
}
补充:软件开发 , C++ ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,