hdu2032
2015-11-05 15:42
281 查看
http://acm.hdu.edu.cn/showproblem.php?pid=2032
#include<stdio.h> #include<math.h> #include<string.h> #include<stdlib.h> #include<iostream> using namespace std; int main() { //freopen("in.txt","r",stdin); int n; int a[40][40]; memset(a,0,sizeof(a)); a[1][1]=1; a[2][1]=1; a[2][2]=1; for(int i=1;i<=30;i++) a[i][1]=1; for(int i=3;i<=30;i++) { for(int j=2;j<=30;j++) { a[i][j]=a[i-1][j-1]+a[i-1][j]; } } while(~scanf("%d",&n)) { for(int i=1;i<=n;i++) { for(int j=1;j<=n;j++) { if(a[i][j]==0) continue; if(j==1) printf("%d",a[i][j]); else printf(" %d",a[i][j]); } printf("\n"); } cout<<endl; } return 0; }
相关文章推荐
- Baseline管理
- Linux运维 第三阶段 (十二)tcp wrapper
- 关于回避风险策略
- 自定义控件其实很简单 六
- android adapter类图
- 常用正则
- Codeforces Round #329 (Div. 2) (A, B)
- 举例讲解Python中的死锁、可重入锁和互斥锁
- Android Studio 快捷键提示为方框问题的解决
- 如何搭建企业内部免费git服务器?
- UITextView、UITableView、UIScrollView上面有一行空白
- BZOJ 1088: [SCOI2005]扫雷Mine( )
- 今天开始撰写博客,希望可以坚持下去
- input输入框的光标
- mysql外链接查询
- js返回最终样式函数,兼容IE和DOM,设置参数:元素对象、样式特性
- 会计的借贷关系
- mark Java NIO
- C++设计模式——观察者模式
- 开源项目Coding学习笔记(1):EaseStartView --- 第一个界面