#include <stdio.h> int main(){ int N,U,D; int len=0; int direction=1; int count=0; if (scanf("%d",&N)!=EOF && scanf("%d",&U)!=EOF && scanf("%d",&D)!=EOF){ while (len<N){ if (direction==1){len = len+direction*U;} if (direction==-1){len = len+direction*D;} direction = direction*-1; count++; if (len>=N){break;} } printf("%d",count); }else{ printf("something wrong when input N,U,D"); } return 0; }
c语言编程练习题:7-46 爬动的蠕虫
作者:yunjinqi
类别:编程
日期:2023-05-29 16:04:20
阅读:555 次
消耗积分:0 分
版权所有,转载本站文章请注明出处:云子量化, https://www.yunjinqi.top/article/171
最新文章
系统当前共有 404 篇文章