编程题: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);
}

}

posted on 2025-05-12 23:22  Swishy  阅读(4)  评论(0)    收藏  举报