Back to the Training Home
Lesson: 22 Problem: 1516 Title: Climbing Worm Difficulty Level: 1.5 Date: FEB 27, 2009 Site: http://acm.tju.edu.cn/toj/ Very simple problem. I think you already solvedBack to the Training Home
this type of problems at your high school math classes. Source Code: #include<stdio.h> void FindRes(int n, int u, int d) { int net = u - d; int min = n - u; int k = (min + net -1)/net; printf("%d\n",k*2+1); } int main() { int n, u, d; while(scanf("%d%d%d",&n,&u,&d) == 3) { if(!n&&!u&&!d) break; FindRes(n,u,d); } return 0; }