์•Œ๊ณ ๋ฆฌ์ฆ˜ ๋ฌธ์ œ/BOJ_Java

[BOJ/Step2] 9498 : ์‹œํ—˜ ์„ฑ์  (JAVA)

NaNaRin๐Ÿ™ƒ 2021. 1. 6. 17:50

www.acmicpc.net/problem/9498

 

9498๋ฒˆ: ์‹œํ—˜ ์„ฑ์ 

์‹œํ—˜ ์ ์ˆ˜๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ 90 ~ 100์ ์€ A, 80 ~ 89์ ์€ B, 70 ~ 79์ ์€ C, 60 ~ 69์ ์€ D, ๋‚˜๋จธ์ง€ ์ ์ˆ˜๋Š” F๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

www.acmicpc.net


๋ฌธ์ œ

์‹œํ—˜ ์ ์ˆ˜๋ฅผ ์ž…๋ ฅ๋ฐ›์•„ 90 ~ 100์ ์€ A, 80 ~ 89์ ์€ B, 70 ~ 79์ ์€ C, 60 ~ 69์ ์€ D, ๋‚˜๋จธ์ง€ ์ ์ˆ˜๋Š” F๋ฅผ ์ถœ๋ ฅํ•˜๋Š” ํ”„๋กœ๊ทธ๋žจ์„ ์ž‘์„ฑํ•˜์‹œ์˜ค.

 

์ž…๋ ฅ

์ฒซ์งธ ์ค„์— ์‹œํ—˜ ์ ์ˆ˜๊ฐ€ ์ฃผ์–ด์ง„๋‹ค. ์‹œํ—˜ ์ ์ˆ˜๋Š” 0๋ณด๋‹ค ํฌ๊ฑฐ๋‚˜ ๊ฐ™๊ณ , 100๋ณด๋‹ค ์ž‘๊ฑฐ๋‚˜ ๊ฐ™์€ ์ •์ˆ˜์ด๋‹ค.

 

์ถœ๋ ฅ

์‹œํ—˜ ์„ฑ์ ์„ ์ถœ๋ ฅํ•œ๋‹ค.

 

์˜ˆ์ œ ์ž…๋ ฅ 1

100

 

์˜ˆ์ œ ์ถœ๋ ฅ 1

A


ํ’€์ด

 

import java.util.Scanner;

public class B9498 {

	public static void main(String[] args) {
		
		Scanner sc = new Scanner(System.in);
		
		int score = sc.nextInt();	
		
		if (score >= 90) {
			System.out.println("A");
		} else if (score >= 80) {
			System.out.println("B");
		} else if (score >= 70) {
			System.out.println("C");
		} else if (score >= 60) {
			System.out.println("D");
		} else {
			System.out.println("F");
		}
	}
}