Notice
Recent Posts
Link
Tags
- DI
- static
- join
- spring boot
- string
- 자바
- 데이터베이스
- 1차원 배열
- Docker
- Django
- 문자열
- spring mvc
- springboot
- 프로그래머스
- mysql
- SSL
- 스프링부트
- java
- spring security 6
- 스프링
- spring
- select
- AWS
- jpa
- PYTHON
- ORM
- nginx
- hibernate
- @transactional
- sql
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
개발하는 자몽
[5622] 문자열 - 다이얼 본문
문제

코드
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
//buffer와 switch-case를 사용한 방법 외 다른 방법
int cnt = 0;
int input;
while (true) {
input = System.in.read();
if (input == '\n')
break;
if (input < 68) cnt += 3;
else if (input < 71) cnt += 4;
else if (input < 74) cnt += 5;
else if (input < 77) cnt += 6;
else if (input < 80) cnt += 7;
else if (input < 84) cnt += 8;
else if (input < 87) cnt += 9;
else cnt += 10;
}
System.out.print(cnt);
}
}'Algorithm' 카테고리의 다른 글
| [1316] 문자열 - 그룹 단어 체커 (0) | 2022.04.22 |
|---|---|
| [2941] 문자열 - 크로아티아 알파벳 (0) | 2022.04.21 |
| [2908] 문자열 - 상수 (2) | 2022.04.19 |
| [1152]문자열 - 단어의 개수 (0) | 2022.04.18 |
| [1157]문자열 - 단어 공부 (0) | 2022.04.17 |
Comments