Notice
Recent Posts
Recent Comments
Link
«   2026/06   »
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
Archives
Today
Total
관리 메뉴

dh-winternagi 님의 블로그

(5622) 다이얼 본문

백준 (C++)/Solve

(5622) 다이얼

dh-winternagi 2026. 4. 10. 18:53

https://www.acmicpc.net/problem/5622

단계별로 풀어보기

5단계(문자열) 10번째

 

 

 

#include <iostream>
using namespace std;

int main() 
{
  string s;
  int ans= 0;
  int dial[26]= {3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,8,8,8,8,9,9,9,10,10,10,10};
  
  cin >> s;
  
  for(char c:s)  ans+= dial[c-'A'];
  
  cout << ans;
  
  return 0;
}

'백준 (C++) > Solve' 카테고리의 다른 글

(25083) 새싹  (0) 2026.04.10
(11718) 그대로 출력하기  (0) 2026.04.10
(2908) 상수  (0) 2026.04.10
(1152) 단어의 개수  (0) 2026.04.10
(2675) 문자열 반복  (0) 2026.04.10