티스토리 뷰
백준 5622번
문제 사이트 :
https://www.acmicpc.net/problem/5622
#include <iostream> #include <stdio.h> #include <stdlib.h> #include <algorithm> using namespace std; int Array[11] = { 0,2,3,4,5,6,7,8,9,10,11}; int main(void) { char ch[16]; int num = 0; scanf("%s", ch); for (int i = 0; ch[i] != '\0'; i++) { if (ch[i] == 'A' || ch[i] == 'B' || ch[i] == 'C') { num += Array[2]; } if (ch[i] == 'D' || ch[i] == 'E' || ch[i] == 'F') { num += Array[3]; } if (ch[i] == 'G' || ch[i] == 'H' || ch[i] == 'I') { num += Array[4]; } if (ch[i] == 'J' || ch[i] == 'K' || ch[i] == 'L') { num += Array[5]; } if (ch[i] == 'M' || ch[i] == 'N' || ch[i] == 'O') { num += Array[6]; } if (ch[i] == 'P' || ch[i] == 'Q' || ch[i] == 'R' || ch[i] =='S') { num += Array[7]; } if (ch[i] == 'T' || ch[i] == 'U' || ch[i] == 'V') { num += Array[8]; } if (ch[i] == 'W' || ch[i] == 'X' || ch[i] == 'Y' ||ch[i] == 'Z') { num += Array[9]; } } printf("%d", num); return 0; }
'PS > 백준' 카테고리의 다른 글
10039번 평균 점수 (0) | 2019.06.24 |
---|---|
8958번 OX퀴즈 (0) | 2019.06.24 |
4673번 셀프 넘버 (0) | 2019.06.24 |
4344번 평균은 넘겠지 (0) | 2019.06.22 |
2941번 크로아티아 알파벳 (0) | 2019.06.22 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 분할정복
- UIView
- MVC
- HumanInterfaceGuidelines
- 오토레이아웃
- HIG
- 온라인저지
- Human Interface Guidelines
- ios
- storage
- 디자인패턴
- Firebase
- 알고리즘
- 백준
- 싱글톤
- DP
- apple
- Human Interface Guideline
- Swift
- 부스트코스
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | 6 | |
7 | 8 | 9 | 10 | 11 | 12 | 13 |
14 | 15 | 16 | 17 | 18 | 19 | 20 |
21 | 22 | 23 | 24 | 25 | 26 | 27 |
28 | 29 | 30 |
글 보관함