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
- CH01
- Fisher discriminant analysis
- directed graphical model
- 5397번
- 알고리즘
- Numerical optimization
- 인공지능
- 선형분류
- chapter02
- 개발순서
- MySQL
- 스터디
- SCPC
- 1차예선
- 자바ORM표준JPA프로그래밍
- Perceptron Convergence theorem
- 델타 rule
- 근구하기
- 선형판별분석
- graphical models
- undirected graphical model
- secant
- vector미분
- falsePosition
- 알고리즘대회
- 2018
- 이것이 MySQL이다
- bisection
- chapter01
- 로지스틱 회귀
Archives
- Today
- Total
computer_study
[탐색] BAEKJOON '1568'번 '새'문제 (C++/python) 본문
문제 : www.acmicpc.net/problem/1568
-
python
n = int(input())
result = 0
to_sing_num = 1
while n != 0:
if to_sing_num > n:
to_sing_num = 1
n -= to_sing_num
to_sing_num += 1
result += 1
print(result)
-
c++
#include "iostream"
using namespace std;
int result=0;
void count_seconds(int birds, int to_sing_num){
if(birds == to_sing_num){
result ++;
printf("%d\n",result);
}
else if(birds > to_sing_num){
result ++;
count_seconds(birds - to_sing_num, to_sing_num + 1);
}
else
count_seconds(birds, 1);
}
int main(){
unsigned int N;
scanf("%d",&N);
count_seconds(N, 1);
return 0;
}
'알고리즘 > 문제풀이' 카테고리의 다른 글
[c++] codeground 연습문제 '버스 타기'(2018년도 SCPC 예선1차) (0) | 2020.08.12 |
---|---|
[탐색] BAEKJOON '1302'번 '베스트셀러'문제 (C++/python) (0) | 2020.08.11 |
[탐색] BAEKJOON '1543'번 '문서 검색'문제 (C++/python) (0) | 2020.08.11 |
[재귀함수] BAEKJOON ' 7490 '번 '0 만들기 '문제 (C++/python) (0) | 2020.08.11 |
[재귀함수] BAEKJOON '1074'번 'Z'문제 (C++/python) (0) | 2020.08.07 |
Comments