每日一练

每日一练,第1张

每日一练

package cn.itcast.girl.TheBlueCup_02;

import java.util.Scanner;

public class DangerousArea {

    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Scanner sc = new Scanner(System.in);
        int s = sc.nextInt();
        int x = sc.nextInt();
        double step = 7;
        double sum = 0;
        if(s             if(s+x<=7) {
                System.out.println("y");
            }else {
                System.out.println("n");
            }
        }else {
            for(int i=1;;i++) {
                sum += step;
                step = step*0.98;
                if(sum>=s-x) {
                    break;
                }
            }
            sum = sum + step;
            if(sum>=s+x) {
                System.out.println("n");
            }else {
                System.out.println("y");
            }
        }
        sc.close();
    }

}
 

欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/zaji/5719680.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存