250x250
Notice
Recent Posts
Recent Comments
Link
반응형
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- JPA
- Calendar
- List
- 큐
- html
- BFS
- sql
- 리소스모니터링
- union_find
- deque
- 힙덤프
- GC로그수집
- javascript
- set
- Union-find
- 스택
- date
- map
- Java
- CSS
- alter
- math
- dfs
- NIO
- 스프링부트
- priority_queue
- spring boot
- scanner
- Properties
- string
Archives
- Today
- Total
매일 조금씩
백준 5598번: 카이사르 암호 본문
728x90
반응형


+3한 암호니 -3된 형태로 출력되면 된다.
여기서 A,B,C의 경우 X,Y,Z가 된다는 점만 유의 하면된다.
D보다 작은 알파벳의 경우 A를 뺀 후 X를 더하면 되고
그 외의 경우 D를 뺀 후 A를 더하면 된다.
#include <iostream>
#include <string>
using namespace std;
int main(void) {
ios_base::sync_with_stdio(0);
cin.tie(0);
string s, t;
cin >> s;
for (int i = 0; i < s.length(); i++) {
if (s[i] < 'D')
t += s[i] - 'A' + 'X';
else
t += s[i] - 'D' + 'A';
}
cout << t << endl;
return 0;
}
728x90
반응형
'알고리즘' 카테고리의 다른 글
백준 5218번: 알파벳 거리 (0) | 2020.02.16 |
---|---|
백준 5555번: 반지 (0) | 2020.02.16 |
백준 11656번: 접미사 배열 (0) | 2020.02.11 |
백준 2897번: 몬스터 트럭 (0) | 2020.02.09 |
백준 10769번: 행복한지 슬픈지 (0) | 2020.02.08 |