首页 > 试题广场 >

挂科危险

[编程题]挂科危险
  • 热度指数:8534 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32M,其他语言64M
  • 算法知识视频讲解
KiKi想知道这学期他的学习情况,BoBo老师告诉他这学期挂的科目累计的学分,根据所挂学分,判断KiKi学习情况,10分以上:很危险(Danger++),4~9分:危险(Danger),0~3:Good。

输入描述:
一行,一个整数(0~30),表示KiKi挂的科目累计的学分。


输出描述:
一行,根据输入的挂科学分,输出相应学习情况(Danger++,Danger,Good)。
示例1

输入

14

输出

Danger++
示例2

输入

9

输出

Danger
示例3

输入

1

输出

Good
import java.util.Scanner;

/**
 * @Title: 挂科危险
 * @Remark: KiKi想知道这学期他的学习情况,BoBo老师告诉他这学期挂的科目累计的学分,根据所挂学分,判断KiKi学习情况,10分以上:很危险(Danger++),4~9分:危险(Danger),0~3:Good。
 * 输入描述:
 *      一行,一个整数(0~30),表示KiKi挂的科目累计的学分。
 * 输出描述:
 *      一行,根据输入的挂科学分,输出相应学习情况(Danger++,Danger,Good)。
 * @Author: ijunfu
 * @Version: 1.0.0
 * @Date: 2022-03-20
 */
public class Main {

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

        int score = in.nextInt();

        if(score >= 10) {
            System.out.println("Danger++");
        } else if(9 >= score && score >= 4) {
            System.out.println("Danger");
        } else {
            System.out.println("Good");
        }

        in.close();
    }
}

发表于 2022-03-20 11:33:24 回复(0)
import java.util.*;
public class Main{
    public static void main(String[] args){
        Scanner sc = new Scanner(System.in);
        int a = sc.nextInt();
        if(a>10){
            System.out.print("Danger++");
        }else if(a>=4){
            System.out.print("Danger");
        }else if(a>=0){
            System.out.print("Good");
        }
    }
}
发表于 2022-01-14 10:10:22 回复(0)
import java.util.Scanner;
public class Main{
    public static void main(String [] args){
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        if (0<=n&&n<=3)
            System.out.print("Good");
        else if (4<=n&&n<=9)
            System.out.print("Danger");
        else 
            System.out.print("Danger++");
            
    }
}
发表于 2020-06-15 12:20:24 回复(0)