백준 15489번

2022. 2. 14. 02:44·Study/Algorithm

https://www.acmicpc.net/problem/15489

 

15489번: 파스칼 삼각형

첫째 줄에 양의 정수 R, C, W가 공백을 한 칸씩 두고 차례로 주어진다. (단, 2 ≤ R+W ≤ 30, 2 ≤ C+W ≤ 30, 1 ≤ W ≤ 29, C ≤ R)

www.acmicpc.net

#include <iostream>

using namespace std;

int main() {
	int dp[31][31];

	int R, C, W;
	cin >> R >> C >> W;
	
	for (int i = 1; i <= 30; i++) {
		for (int j = 1; j <= i; j++) {
			if (j == 1 || j == i)
				dp[i][j] = 1;
			else
				dp[i][j] = dp[i - 1][j - 1] + dp[i - 1][j];
		}
	}

	int result = 0;
	for (int i = 0; i < W; i++) {
		for (int j = 0; j <= i; j++) {
			result += dp[R + i][C + j];
		}
	}
	cout << result;
}

'Study > Algorithm' 카테고리의 다른 글

백준 21921번  (0) 2022.02.21
백준 20922번  (0) 2022.02.21
백준 16953번  (0) 2022.02.08
백준 14916번  (0) 2022.02.08
백준 1021번  (0) 2022.02.07
'Study/Algorithm' 카테고리의 다른 글
  • 백준 21921번
  • 백준 20922번
  • 백준 16953번
  • 백준 14916번
_WooHyun_
_WooHyun_
  • _WooHyun_
    Nerd
    _WooHyun_
  • 전체
    오늘
    어제
    • 분류 전체보기 (79)
      • Study (60)
        • Algorithm (24)
        • Unreal Engine (19)
        • C++ (1)
        • Maya (1)
        • GoLang (3)
        • Mysql (3)
        • Linux (7)
        • Server (2)
      • Projects (0)
        • Unreal Engine (0)
        • Server (0)
      • 개발일지 (8)
        • Unreal Engine (7)
        • Art (1)
        • Server (0)
      • 미래 (5)
      • 개발아이디어 (0)
      • 잡지식 (2)
  • 블로그 메뉴

    • 홈
    • 방명록
    • 글쓰기
    • 블로그설정
  • 링크

    • GitHub
  • 공지사항

  • 인기 글

  • 태그

  • 최근 댓글

  • 최근 글

  • hELLO· Designed By정상우.v4.10.3
_WooHyun_
백준 15489번
상단으로

티스토리툴바