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