HDU1049(水题)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1049
直接贴代码:
View Code
1 #include <cstdio> 2 using namespace std; 3 4 int main() 5 { 6 int n, u, d; 7 int m; 8 while(scanf("%d%d%d", &n, &u, &d) != EOF && n != 0) 9 { 10 m = (n - d) / (u - d); 11 if((n-d)%(u-d) != 0) 12 { 13 m++; 14 } 15 printf("%d\n", 2*m-1); 16 } 17 return 0; 18 }