#include <iostream>
#include <cstdio>
#include <bits/stdc++.h>
using namespace std;
int main(){
int m,n,h;
scanf("%d %d %d",&m,&n,&h);
int a=0;
for(int i=1; ;i++){
a+=m;
if(a>=h){
printf("%d",i);
return 0;
}
else
a-=n;
}
return 0;
}
Description
关于小青蛙爬井的故事,你应该早就听过了:井深10尺,小青蛙从井底向上爬,每个白天向上爬3尺,每个晚上又滑下来2尺,然后问你第几天它能爬上来。答案是第8天。 现在,那只著名的小青蛙又回来了,它现在每个白天已经可以向上爬m(2 <= m <=10)尺了,当然,晚上还是要下滑n(1 <= n < m )尺的。如果告诉你井深h(10 <= h <= 200)尺,请计算一下,现在,它第几天可以爬上来。
Input
有三个整数,分别表示 m、 n、 h。
Output
只有一个整数,表示第几天可以爬上来。
Sample Input 1
3 2 10
Sample Output 1
8
Source
需要找规律的循环