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 | 31 |
Tags
- c++
- 브루트포스
- 구현
- 북리뷰
- Operating System
- OS
- 개발
- Stack
- 자료구조
- 코테
- 정석학술정보관
- 코딩
- 컴퓨터공학과
- bfs
- 스택
- 문제풀이
- 컴공과
- 백준
- cs
- 너비우선탐색
- 그래프
- 정석
- vector
- DP
- 오퍼레이팅시스템
- coding
- 오에스
- 알고리즘
- Computer science
- 컴공
Archives
- Today
- Total
Little Jay
[C++] 백준 14912번 숫자 빈도수 본문
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
char digit;
cin >> n >> digit;
int repeated = 0;
for (int i = 0; i < n; i++) {
string num = to_string(i + 1);
for (int k = 0; k < num.length(); k++) {
if (num[k] == digit)
repeated++;
}
}
cout << repeated << "\n";
return 0;
}'알고리즘 > BOJ' 카테고리의 다른 글
| [C++] 백준 11650번 좌표 정렬하기 (0) | 2021.03.25 |
|---|---|
| [C++] 백준 11170번 0의 개수 (0) | 2021.03.25 |
| [C++] 백준 1531번 투명 (0) | 2021.03.23 |
| [C++] 백준 1292번 쉽게 푸는 문제 (0) | 2021.03.23 |
| [C++] 백준 11050번 이항 계수1 (0) | 2021.03.21 |
Comments