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
- #Swagger-editor
- Site Reliability engineering
- action
- IP
- Reducer
- 프로세스 통신
- #Swagger-ui
- #Swagger-codegen
- #스웨거
- 모두의캠퍼스
- Kubernetes
- SRE
- AWS
- 카카오게임즈
- ecs
- server
- #Swagger
- React.js
- 북딜
- docker
- fluentd
- javascript
- 기술PM
- 쿠버네티스 컨트롤러
- 쿠버네티스
- Redux
- #api 문서화
- React
- 모캠
- 프로세스
반응형
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