728x90
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λ₯Ό μΆλ ₯νλ νλ‘κ·Έλ¨μ μμ±νμμ€.
Solution
Python
score = int(input())
if 100 >= score and score >= 90:
print('A')
elif 89 >= score and score >= 80:
print('B')
elif 79 >= score and score >= 70:
print('C')
elif 69 >= score and score >= 60:
print('D')
else:
print('F')
Java
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int score = sc.nextInt();
if(100 >= score && score >= 90) {
System.out.println('A');
} else if (89 >= score && score >= 80) {
System.out.println('B');
} else if (79 >= score && score >= 70) {
System.out.println('C');
} else if (69 >= score && score >= 60) {
System.out.println('D');
}else {
System.out.println('F');
}
}
}
C
#include <stdio.h>
int main() {
int score;
scanf("%d", &score);
if (score >= 90)
printf("A");
else if (score >= 80)
printf("B");
else if (score >= 70)
printf("C");
else if (score >= 60)
printf("D");
else
printf("F");
return 0;
}728x90
'π§© Algorithm > [BOJ] Bronze' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
| BOJ 3003λ² : νΉ, νΈ, 룩, λΉμ, λμ΄νΈ, ν° (Python, Java/ꡬν/Bronze 5) (0) | 2024.03.19 |
|---|---|
| BOJ 4999λ² : μ! (Python, Java/ꡬν/Bronze 5) (0) | 2024.03.19 |
| BOJ 1000λ² : A+B (Python, Java/ꡬν/Bronze 5) (0) | 2024.03.17 |
| BOJ 2935λ² : μμ (Python/ꡬν/Bronze 3) (0) | 2024.03.16 |
| BOJ 5355λ² : νμ± μν (Python/ꡬν/Bronze 2) (0) | 2024.03.16 |