699 - The Falling Leaves---递归
来源:互联网 发布:趣店数据疑似外泄 编辑:程序博客网 时间:2024/05/10 01:10
#include <iostream>#include <cstdio>#include <cstdlib>#include <cstring>#include <vector>#include <algorithm>#define N 100using namespace std;int a[N*2];void build(int value ,int w){ int n; a[w]+=value; scanf("%d",&n); if(n!=-1) build(n,w-1); scanf("%d",&n); if(n!=-1) build(n,w+1);}int main(){ //freopen("ex.in","r",stdin); int n,ncase=0; while(scanf("%d",&n)&&n!=-1) { memset(a,0,sizeof(a)); build(n,N); int i=0; printf("Case %d:\n",++ncase); while(!a[i]) i++; printf("%d",a[i]); for(i++; a[i]; i++) printf(" %d",a[i]); printf("\n\n"); } return 0;}
- 699 - The Falling Leaves---递归
- UVa 699 The Falling Leaves(递归建树)
- UVa 699 - The Falling Leaves【递归】
- 699 - The Falling Leaves
- 699 - The Falling Leaves
- 699 - The Falling Leaves
- 699 - The Falling Leaves
- 699 - The Falling Leaves
- 699 - The Falling Leaves
- 699 - The Falling Leaves
- 699 - The Falling Leaves
- 699 - The Falling Leaves
- Uva-699 - The Falling Leaves(二叉树与递归)
- uva 699 - The Falling Leaves
- uva 699 The Falling Leaves
- uva 699 - The Falling Leaves
- UVa 699 - The Falling Leaves
- UVA 699 - The Falling Leaves
- VMware设置从光驱中引导启动Linux操作系统
- POJ 1519 Digital Roots -- from lanshui_Yang
- SQL Server到底在说啥
- 栈的链接存储
- Chapter 1.main函数
- 699 - The Falling Leaves---递归
- 2012 Multi-University Training Contest 5-1006 hdu4344 Mark the Rope
- android 控件的隐藏和显示
- 数据库学习实践(三)--使用数据绑定
- srm
- Chapter 2.变量和类型
- Windows下nginx1.x + php5环境配置
- 线段树
- 动态规划