풀이: 2014 경기도 상업경진대회 프로그래밍 문제 4번

3학년1반

풀이: 2014 경기도 상업경진대회 프로그래밍 문제 4번

소프트웨어과 0 992 2019.05.17 10:00
#include<stdio.h>
 
int res[21][21] = {0,};
 
void setArray(int rows, int cols)
{
    for(int i = 0 ; i < rows ; i++)
    {
        for(int j=0; j < cols ; j++)
        {
            if( (i == 0)  ) res[i][j] = 1;
            else    res[i][j] = res[i-1][j] + res[i][j-1];
        }
    }  
}
 
int main(void)
{
    int rows = 0, cols = 0;
    scanf("%d %d",&rows,&cols);
    setArray(rows,cols);   
     
    for(int i = 0 ; i <rows ; i++)
    {
        for(int j = 0 ; j <cols ; j++)
        {
            printf("%d ",res[i][j]);
        }
        printf("\n");
    }
}

Comments

Category
반응형 구글광고 등
State
  • 현재 접속자 57 명
  • 오늘 방문자 491 명
  • 어제 방문자 3,319 명
  • 최대 방문자 3,319 명
  • 전체 방문자 494,780 명
  • 전체 게시물 6,892 개
  • 전체 댓글수 131 개
  • 전체 회원수 31 명
Facebook Twitter GooglePlus KakaoStory NaverBand