/ 科创班 /

记录详情

Accepted


  
# 状态 耗时 内存占用
#1 Accepted 3ms 256.0 KiB
#2 Accepted 2ms 256.0 KiB
#3 Accepted 2ms 256.0 KiB
#4 Accepted 1ms 256.0 KiB
#5 Accepted 1ms 256.0 KiB
#6 Accepted 1ms 256.0 KiB
#7 Accepted 2ms 256.0 KiB
#8 Accepted 2ms 256.0 KiB
#9 Accepted 2ms 256.0 KiB

代码

#include <stdio.h>

int main()
{
    int i, j, n, a[34][34];
    scanf("%d", &n);
    for (i = 0; i < n; i++)
    {
        a[i][0] = 1;
        a[i][i] = 1; 
        for (j = 1; j < i; j++)
            a[i][j] = a[i-1][j-1] + a[i-1][j];
    }
    for (i = 0; i < n; i++)
    {
        for (j = 0; j <= i; j++)
            printf("%d ", a[i][j]);
        printf("\n");
    }
    return 0;
}

信息

递交者
类型
递交
题目
杨辉三角 c
题目数据
下载
语言
C
递交时间
2018-10-20 16:39:58
评测时间
2018-10-20 16:39:58
评测机
分数
100
总耗时
21ms
峰值内存
256.0 KiB