C++ 小青蛙爬井问题:优化爬行速度
#include
int main() { int m, n, h; cin >> m >> n >> h; int day = 0; int height = 0;
while (height < h) {
day++;
height += m;
if (height >= h) {
break;
}
height -= n;
}
cout << day << endl;
return 0;
}
原文地址: https://www.cveoy.top/t/topic/bVfU 著作权归作者所有。请勿转载和采集!