Recent Posts
Recent Comments
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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
- 모두의캠퍼스
- AWS
- 모캠
- 프로세스 통신
- SRE
- React.js
- Kubernetes
- 쿠버네티스
- #api 문서화
- server
- 프로세스
- IP
- #Swagger
- #Swagger-ui
- Reducer
- 기술PM
- 북딜
- 쿠버네티스 컨트롤러
- #스웨거
- Site Reliability engineering
- React
- javascript
- fluentd
- Redux
- 카카오게임즈
- #Swagger-editor
- #Swagger-codegen
- docker
- action
- ecs
반응형
Archives
- Today
- Total
탕구리's 블로그
백준 알고리즘 9461번 파도반 수열 본문
반응형
그냥, 규칙을 찾으면 되는 문제!
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* Created by idongsu on 2017. 7. 30..
*/
public class num_9461 {
static public void main(String args[]) throws IOException
{
BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
int T = Integer.parseInt(in.readLine());
long dp[] = new long[101];
dp[1] = 1; dp[2] = 1; dp[3]= 1; dp[4] = 2;
int k=0;
for(int i =1; i< T+1; i++)
{
k = Integer.parseInt(in.readLine());
if(k>4)
{
for(int j =4; j<=k; j++)
dp[j]= dp[j-3]+dp[j-2];
}
System.out.println(dp[k]);
}
}
}반응형
'Algorithm' 카테고리의 다른 글
| BOJ 11403번 경로찾기 (0) | 2019.03.12 |
|---|---|
| 방향 그래프 (Directed Graph) (0) | 2019.03.12 |
| 백준 알고리즘 11066번 파일합치기 (0) | 2017.07.26 |
| 백준 알고리즘 11726번 2*N 타일링 (0) | 2017.07.26 |
| 백준 알고리즘 11727번 2*N 타일링 2 (0) | 2017.07.26 |
Comments