HDU--2032
来源:互联网 发布:java的substring方法 编辑:程序博客网 时间:2024/05/22 00:18
点击打开原题
关键是下一行与上一行的关系
另外保证每一行的首尾均为1
~水过
#include <iostream>#include<cstring>using namespace std;int main() { int n,i,j; int arrp[30],arrn[30]; while(cin>>n) { arrp[0]=arrp[1]=arrn[0]=1; cout<<1<<endl; if(n==1){ cout<<endl; continue; } cout<<1<<' '<<1<<endl; if(n==2){ cout<<endl; continue; } for(i=3; i<=n; i++) { cout<<1<<' '; for(j=1;j<i-1;j++){ arrn[j]=arrp[j-1]+arrp[j]; arrp[j-1]=arrn[j-1]; cout<<arrn[j]<<' '; } arrp[i-2]=arrn[i-2]; arrp[i-1]=1; cout<<1<<endl; } cout<<endl; } return 0;}
0 0
- hdu 2032
- hdu 2032
- hdu 2032
- HDU-2032
- hdu 2032
- HDU--2032
- HDU-2032
- HDU 2032
- hdu 2032
- HDU--2032
- hdu 2032
- HDU 2032
- hdu oj 2032
- HDU 2032 JAVA
- hdu
- hdu
- HDU
- hdu ()
- JAVA编程常识汇总
- 每天laravel-20160725| Genaerator command-3
- 集成Dubbo服务(Spring)
- C++调用jar包
- Xcode7.1环境下上架iOS App到AppStore 流程 (Part 一)
- HDU--2032
- 单机版APP记住密码功能的实现及EditText的输入框背景设置
- android中的通信机制总结
- android 根目录 File Explore 下各个文件的含义及其关系
- 浅谈requireJS
- iOS的edgesForExtendedLayout、automaticallyAdjustsScrollViewInsets属性
- kibana查询语法
- GIS+=地理信息+大数据技术——GIS大数据可视化分析工具
- MySql,Mssql,Oracle三种数据库性能优缺点及异同