[파이썬][백준 2754번] 학점계산
1. 문제Permalink
[Bronze II] 학점계산 - 2754Permalink
성능 요약Permalink
메모리: 30840 KB, 시간: 68 ms
분류Permalink
구현(implementation), 문자열(string)
출처: 백준, https://https://www.acmicpc.net/
2. 해결방법 시간복잡도Permalink
- 단순 코딩 O(1)
3. 문제 해결 및 코드Permalink
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
T = str(input()) | |
point = {'A+': 4.3, | |
'A0': 4.0, | |
'A-': 3.7, | |
'B+': 3.3, | |
'B0': 3.0, | |
'B-': 2.7, | |
'C+': 2.3, | |
'C0': 2.0, | |
'C-': 1.7, | |
'D+': 1.3, | |
'D0': 1.0, | |
'D-': 0.7, | |
'F': 0.0} | |
print(point[T]) |
-
주석을 참고하면서 이해를 돕습니다.Permalink
4. 알고리즘 및 해설Permalink
- 딕셔너리를 만들어서 해당 학점에 해당하는 점수를 출력해준다.