SOJ.Output the Yanghui triangel

Output the Yanghui triangel

 
 
总提交数量: 225 通过数量: 59
 
     
     
 

时间限制:1秒    内存限制:256兆

题目描写叙述

Write program to output the Yanghui triangel of n*n, where n is an input. The Yanghui triangel is defined as

1

1 1

1 2 1

1 3 3 1

1 4 6 4 1

1 5 10 10 5 1

..........................

输入格式

Each  lines  of the input is an integer that denotes the dimension of the Yanghui triangel that will be outputted to the screen.

An input 0 denotes the end of the input.

输出格式

Each value of the output is followed by a TAB, include the last value of a line.

例子输入

将例子输入拷贝到剪贴板

5
6
7
0

例子输出

1
1	1
1	2	1
1	3	3	1
1	4	6	4	1
1
1	1
1	2	1
1	3	3	1
1	4	6	4	1
1	5	10	10	5	1
1
1	1
1	2	1
1	3	3	1
1	4	6	4	1
1	5	10	10	5	1
1	6	15	20	15	6	1

题目中的TAB表示制表符\t。一開始没注意看两位数输出和一位数输出也被坑慘了

时间: 2024-08-03 01:37:22

SOJ.Output the Yanghui triangel的相关文章

soj 1015 Jill's Tour Paths 解题报告

题目描述: 1015. Jill's Tour Paths Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description Every year, Jill takes a bicycle tour between two villages. There are different routes she can take between these villages, but she does have an upper limit

单调栈(SOJ 3085)

SOJ 3085: windy's cake V http://acm.scu.edu.cn/soj/problem.action?id=3085 Problem: Given a list of $n$ positive integers $num[1], ..., num[n]$, denote the score of one sublist from $i$ to $j$ as $(\min_{i\le k\le j}num[k])*\left(\Sigma_{k=i}^{j}num[k

最大子矩阵(SOJ 3329)

SOJ 3329: Maximum Submatrix II http://acm.scu.edu.cn/soj/problem.action?id=3329 Problem: Given a $0-1$ matrix, find the maximum submatrix which contains only 0s and output the number of 0s in it. Technique: (1) Dynamic Programming Denote $dp[i][j], 1

output value

http://neuralnetworksanddeeplearning.com/chap3.html // This is a paper.js widget to show a single neuron learning. In // particular, the widget is used to show the learning slowdown that // occurs when the output is saturated. // // The same basic wi

Codeblocks 遇到的问题 Cannot open output file, permission denied

Codeblocks下运行C++的程序时,偶尔会出现  Cannot open output file, permission denied 的问题,导致不能够编译. 在 Stack Overflow 上看到有过类似的遭遇.   链接地址 I have encountered the same problem you have. I found that it may have some relationship with the way you terminate your run resul

数据库服务器Input/output error (故障20170122)

描述: 数据库系统出现告警,登陆查看使用系统命令报错,提示Input/output error 模拟故障处理过程: 检查文件系统时,该文件系统必须卸载.当出现错误时fsck会提示是否修复, 可以用-y参数:不提示是否修复 fsck - check and repair a Linux file system # df -h Filesystem            Size  Used Avail Use% Mounted on /dev/mapper/vg_mysql80-lv_root 2

php输出控制output controll(header, ob_xxx)

关于php的output controll参考文档: http://gywbd.github.io/posts/2015/1/php-output-buffer-in-deep.html http://www.cnblogs.com/liuzhang/p/4161213.html 众所周知,调用header()函数之前不能有任何输出到浏览器,否则会报错. 如何复现这种情况: 1.php.ini设置output_buffering OFF 2.测试代码: echo 2; header("HTTP/

[SOJ] 简单哈希

Description 使用链地址法(又称拉链法)可以解决Hash中的冲突问题.其基本思想是:将具有相同哈希地址的记录链成一个单链表,m个哈希地址就设m个单链表,然后用一个数组将m个单链表的表头指针存储起来,形成一个动态的结构(图1). 现在给定哈希函数为Hash(key)= key mod 13,要求使用链地址法处理冲突,设有冲突的元素均插入表尾.要求建立起相应哈希表,并按一定格式打印. Input 输入包含多组数据.对于每组数据: 第1行为整数n(1 <=n <= 100), 代表key的

[SOJ] Ordering Tasks

1940. Ordering Tasks Constraints Time Limit: 1 secs, Memory Limit: 32 MB Description John has n tasks to do. Unfortunately, the tasks are not independent and the execution of one task is only possible if other tasks have already been executed. Input