uva 839 (Not so mobile)天平 ---递归输入
来源:互联网 发布:淘宝折扣秒杀群 编辑:程序博客网 时间:2024/06/04 18:22
java的写法
import java.util.Scanner;public class Main {static Scanner scan = new Scanner(System.in);public static void main(String[] args) {int T = scan.nextInt();while(T--!=0){if(solve(new M(0))){System.out.println("YES");}else{System.out.println("NO");}if(T!=0)System.out.println();}}private static boolean solve(M w) {M wl = new M(scan.nextInt());M dl = new M(scan.nextInt());M wr = new M(scan.nextInt());M dr = new M(scan.nextInt());boolean b1 = true,b2 = true;if(wl.value==0)b1 = solve(wl);if(wr.value==0)b2 = solve(wr);w.value = wl.value+wr.value;return b1&&b2&&wl.value*dl.value==wr.value*dr.value;}static class M{public int value;public M(int value){this.value = value;}}}
0 0
- uva 839 (Not so mobile)天平 ---递归输入
- UVa 839-Not so Mobile(天平)
- 天平 (Not so Mobile, UVa 839)
- UVa 839 Not so Mobile(树的递归输入)
- 例题6-9 天平(Not so Mobile, UVa 839)
- UVa 839 - Not so Mobile【递归】
- UVA 839 Not So Mobile 【递归+树】
- 天平(Not so Mobile)
- uva 839 Not so Mobile 输入外挂
- UVa839-Not so Mobile (天平)
- Not so Mobile 天平 UVA839
- 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
- 【技巧】各国时间显示
- React Native UI学习
- c++ stl 源码解析笔记(一) stl_config 中的模板静态成员定义
- apt-get install 出现bug
- windows7环境下小白安装sass
- uva 839 (Not so mobile)天平 ---递归输入
- 关于git did not exit cleanly (exit code 1)问题的记录
- 跟开涛学SpringMVC...
- 3.7bzoj1030 [JSOI2007]文本生成器
- 如何分析一个网站是否被攻击挂黑链?
- NAL聚合包(STAP-A)
- 卷積邊界處理(copyMakeBorder)
- [题解]HDU2896病毒侵袭、HDU3065病毒侵袭持续中
- mtk8735 mtk8163 mtk8127 mtk6735量产方案 核心板方案 mtk系列平台