# The "Yang Hui triangle" of onlinejudge every day"

Source: Internet
Author: User

Problem
Output: Yang Hui triangle

Input
This topic contains multiple groups of test data, each of which contains only one integer n (n not greater than 34 ). A group of data occupies only one row.

Output
For each group of data, first output

Case #:
# Indicates the # group data. Next, output a Yang Hui triangle composed of numbers. Numbers in a row are separated by a space. Do not have any extra spaces at the end of the line.
One row is empty between the two groups of data.

Sample Input
6
3

Sample output
Case 1:
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1

Case 2:
1
1 1
1 2 1

---------------------

/*
This answer has been compiled and accepted through Tongji
Result memory time Language Date
Accepted 44 K 2 Ms C ++ 18:37:41
Zhouyinhui
*/

# Include <stdio. h>
# Include <malloc. h>

# Define Max 35

Int main ()
{
Int N;
Int casenum = 0;
While (scanf ("% d", & N )! = EOF)
{

Casenum ++;

If (casenum! = 1)
{
Printf ("\ n ");
}

Printf ("case % d: \ n", casenum );

Int I;
Int J;

Int arr [Max] [Max] ={{ 0 }};

For (I = 0; I <n; I ++)
{
Arr [I] [0] = 1;
}

For (I = 1; I <n; I ++)
{
For (j = 1; j <n; j ++)
{
Arr [I] [J] = arr [I-1] [J-1] + arr [I-1] [J];
}
}

For (I = 0; I <n; I ++)
{
For (j = 0; j <n; j ++)
{
If (ARR [I] [J]! = 0)
{
If (J! = I)
{
Printf ("% d", arr [I] [J]);
} Else
{
Printf ("% d", arr [I] [J]);
}
}
}
Printf ("\ n ");
}

}

Return 0;
}

Related Keywords:

### Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.