반응형
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
- @P0
- 6987
- dfs
- 경력
- Kafka
- 처우협의
- boj #19237 #어른 상어
- 처우산정
- BOJ
- compose
- 파라메트릭
- incr
- 성적평가
- Docker
- 13908
- BFS
- 매개변수탐색
- 기술면접
- 소프티어
- 물채우기
- 오퍼레터
- softeer
- 퇴사통보
- OFFSET
- upper_bound
- 백트래킹
- 백준
- msSQL
- 연결요소
- 이분탐색
Archives
- Today
- Total
기술 블로그
[자연수 뒤집기] 자연수 뒤집는 알고리즘 본문
728x90
반응형
자연수를 뒤집는 알고리즘이다.
예) 283 → 382
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 31 32 33 34 35 | #include <iostream> #include <queue> #include <cstdio> #include <vector> #include <cstring> #include <string> #include <math.h> #include <algorithm> using namespace std; int Reverse(int n) { int Before = n; int New = 0; while (Before) { New = (New * 10) + (Before % 10); Before = Before / 10; } return New; } int main(void) { int N = 0; scanf("%d", &N); printf("%d\n", Reverse(N)); return 0; } | cs |
728x90
반응형
'알고리즘' 카테고리의 다른 글
| 효율적인 약수의 개수를 찾는 알고리즘 (0) | 2018.10.14 |
|---|---|
| 이분 매칭 (0) | 2018.09.29 |
| [소수] 에라토스테네스의 체 (0) | 2018.09.26 |
| [정렬] 퀵 정렬(C언어 정렬 함수) (0) | 2018.09.21 |
| [정렬] 퀵 정렬 (0) | 2018.09.18 |