반응형
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 |
Tags
- OFFSET
- 물채우기
- upper_bound
- 기술면접
- 연결요소
- softeer
- 13908
- 백트래킹
- 매개변수탐색
- 이분탐색
- dfs
- 6987
- 소프티어
- 성적평가
- Kafka
- boj #19237 #어른 상어
- @P0
- 퇴사통보
- Docker
- 처우협의
- compose
- 백준
- BOJ
- msSQL
- 파라메트릭
- 경력
- BFS
- 오퍼레터
- incr
- 처우산정
Archives
- Today
- Total
기술 블로그
2577번 숫자의 개수 본문
728x90
반응형
https://www.acmicpc.net/problem/2577
C++의 to_string()만 알면 쉽게 풀 수 있다.
to_stirng() : 숫자(정수형)를 문자열로 바꿔준다.
예)
int num = 123;
string s = to_string(num);
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 | #include <iostream> #include <queue> #include <stack> #include <cstdio> #include <vector> #include <cstring> #include <string> #include <math.h> #include <algorithm> using namespace std; int main(void) { int A = 0, B = 0, C = 0; int num[10] = { 0, }; scanf("%d %d %d", &A, &B, &C); string s = to_string(A*B*C); for (int i = 0; i < s.length(); i++) ++num[s.at(i) - '0']; for (int i = 0; i <= 9; i++) printf("%d\n", num[i]); return 0; } | cs |
728x90
반응형
'알고리즘 문제 > BOJ' 카테고리의 다른 글
1107번 리모컨 (0) | 2018.12.26 |
---|---|
11657번 타임머신 (0) | 2018.12.26 |
5567번 결혼식 (0) | 2018.12.24 |
9372번 상근이의 여행 (0) | 2018.12.19 |
2231번 분해합 (0) | 2018.12.18 |