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
- NLP
- FDS
- 프로그래머스
- 완전탐색
- torchserve
- wandb
- 알고리즘
- autoencoder
- docker
- GitHub Action
- FastAPI
- GIT
- Matplotlib
- DeepLearning
- vscode
- leetcode
- 코딩테스트
- pytorch
- github
- 네이버AItech
- datascience
- Kaggle
- 백준
- pep8
- rnn
- python
- NaverAItech
- Kubernetes
- GCP
- PytorchLightning
Archives
- Today
- Total
Sangmun
백준 1094번 막대기 본문
https://www.acmicpc.net/problem/1094
비트 마스킹으로 풀어도 되는 문제라 가져왔다.
입력 숫자를 이진수로 바꾸었을때 1의 개수를 세주면 정답이 된다.
a = bin(int(input()))
count = 0
for each in str(a[2:]):
if each == '1':
count += 1
print(count)
'알고리즘 > 백준' 카테고리의 다른 글
백준 14938번 서강그라운드 (0) | 2022.12.10 |
---|---|
백준 16953번 A -> B (0) | 2022.12.08 |
n-queen (0) | 2022.11.29 |
백준 1647번 도시분할 계획 (0) | 2022.11.20 |
백준 11779번 최소비용 구하기 2 (0) | 2022.11.20 |
Comments