当前位置: 代码迷 >> 综合 >> ZZULIOJ 1072: 青蛙爬井,Java
  详细解决方案

ZZULIOJ 1072: 青蛙爬井,Java

热度:61   发布时间:2023-11-25 08:23:03.0

1072: 青蛙爬井

import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
    Scanner cin = new Scanner(System.in); int high=cin.nextInt();int up=cin.nextInt();int down= cin.nextInt();int time=0;while(time>=0){
    time++;high-=up;if(high<=0) break;else high+=down;}System.out.printf("%d",time);}
}
  相关解决方案