UVA 839 - Not so Mobile
来源:互联网 发布:用网络发短信的软件 编辑:程序博客网 时间:2024/04/30 04:41
题意:有许多天秤,判断是否为平衡状态。
其实就是二叉树,使用一边的长度乘以重量,再和另一边的比较,如果有一边是0,那么它的下面肯定还有一个秤。
本来用建树再操作写的自己都晕了,后来在网上看到直接用递归输入处理的【膜拜】
#include <cstdio>int flag;int Mobile(){ int Wl, Dl, Wr, Dr; scanf("%d%d%d%d", &Wl, &Dl, &Wr, &Dr); if (Wl == 0) Wl = Mobile(); if (Wr == 0) Wr = Mobile(); if (Wl*Dl != Wr*Dr) flag = 0; return Wl+Wr;}int main(){ int T; scanf("%d", &T); while (T--) { flag = 1; Mobile(); if (flag == 1) printf("Yes\n"); else printf("No\n"); } return 0;}
0 0
- uva 839 - Not so Mobile
- uva 839 Not so Mobile
- uva 839 - Not so Mobile
- UVa 839 - Not so Mobile
- UVa 839 - Not so Mobile
- uva-839 Not so Mobile
- uva 839 - Not so Mobile
- UVA 839 Not so Mobile
- uva 839 Not so Mobile
- Not so Mobile UVA 839
- uva 839 - Not so Mobile
- uva 839 Not so Mobile
- UVa 839 - Not so Mobile
- UVA - 839 Not so Mobile
- UVA 839 Not so Mobile
- UVA - 839 Not so Mobile
- UVA 839 - Not so Mobile
- UVA - 839 Not so Mobile
- boost使用学习总结
- Android手机签核 Eclipse+VS2010+MSSQL
- Netty教程
- CCNU ACM 2016夏季集训·最长递增子序列(LIS)
- 阅读记录
- UVA 839 - Not so Mobile
- Spring控制反转与依赖注入
- POJ 3280 (区间DP)
- python编码问题
- (一个常用的案例)Fragment xlistview pull 网络请求 刷新分页加载 ImageLoader
- 杭电ACM—HDU1035 Robot Motion
- 利用OpenCV实现图像拼接的代码!
- VSS2005配置错误:The Sourcesafe Web service cannot be accessed at the specified address
- 适配器和外观模式