UVA 699 - The Falling Leaves
来源:互联网 发布:录屏软件画中画 编辑:程序博客网 时间:2024/04/30 13:41
#include <cstdio>#include <cstring>#include <cstdlib>#include <cmath>using namespace std;int a[210][210];int sum[210];void creat(int dep, int mid){ int x; scanf("%d", &x); if(x == -1) return; else { a[dep][mid] += x; sum[mid] += x; creat(dep+1, mid-1); creat(dep+1, mid+1); }}int main(){ int root, kase = 0; while(scanf("%d", &root), root != -1) { memset(sum, 0, sizeof(sum)); memset(a, 0, sizeof(a)); int mid = 100; a[0][mid] = root; sum[mid] += root; creat(1, mid-1); creat(1, mid+1); printf("Case %d:\n", ++kase); bool f = true; for(int i = 0; i < 200; ++i) { if(sum[i] != 0) { if(!f) printf(" "), printf("%d", sum[i]); else printf("%d", sum[i]), f = false; } } printf("\n\n"); } return 0;}
- 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
- 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
- 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
- Moderate 判断井字游戏的胜利 @CareerCup
- 数据结构CCArray
- Moderate 阶层的结尾0个数 @CareerCup
- hdu 4791 长沙现场赛A题
- STRUTS2 作用域、参数、响应对象
- UVA 699 - The Falling Leaves
- 嵌入式linux的网络编程(6)--多线程文件服务器
- 黑马程序员----Java概述
- 2013年12月2日 周一
- mongodb分布式集群架构
- 修改Ruby的config.yml文件
- Moderate 不用比较符返回较大的数 @CareerCup
- Spring整合ActiveMQ
- 【网络协议】HTTP协议笔记