编程题:17
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int N = scanner.nextInt();
int U = scanner.nextInt();
int D = scanner.nextInt();
int time = 0;
int height = 0;
while (height < N) {
height += U;
time++;
if (height >= N) {
break;
}
height -= D;
time++;
}
System.out.println(time);
}
}
浙公网安备 33010602011771号