注意,条件:B>=C 。应考虑B=C的情况。

  1. #include<iostream>
  2. using namespace std;
  3.  
  4. int A,B,C;
  5.  
  6. void jugs(int a,int b,int C)
  7. {
  8. if(b==C)
  9. {
  10. cout<<"success"<<endl;
  11.  
  12. }
  13. else if(b==B)
  14. {
  15. cout<<"empty B"<<endl;
  16. jugs(a,,C);
  17. }
  18. else if(a==)
  19. {
  20. cout<<"fill A"<<endl;
  21. cout<<"pour A B"<<endl;
  22. if(A+b>=B)
  23. {
  24. a=A-(B-b);
  25. cout<<"empty B"<<endl;
  26. jugs(a,,C);
  27. }
  28. else
  29. {
  30. jugs(,b+A,C);
  31. }
  32. }
  33. else
  34. {
  35. cout<<"pour A B"<<endl;
  36. if(a+b>=B)
  37. {
  38. a=A-(B-b);
  39. cout<<"empty B"<<endl;
  40. jugs(a,,C);
  41. }
  42. else
  43. {
  44. jugs(,a+b,C);
  45. }
  46. }
  47. return;
  48.  
  49. }
  50.  
  51. int main()
  52. {
  53. while(cin>>A>>B>>C)
  54. {
  55.  
  56. if (A==C)
  57. {
  58. cout<<"fill A"<<endl;
  59. cout<<"success"<<endl;
  60. continue;
  61. }
  62. if (B==C)
  63. {
  64. cout<<"fill B"<<endl;
  65. cout<<"success"<<endl;
  66. continue;
  67. }
  68. jugs(,,C);
  69. }
  70. return ;
  71. }

1.需找bug,参考:

http://www.cnblogs.com/phinecos/archive/2008/09/21/1295472.html

ZOJ Problem Set - 1005的更多相关文章

  1. ZOJ Problem Set - 3829Known Notation(贪心)

    ZOJ Problem Set - 3829Known Notation(贪心) 题目链接 题目大意:给你一个后缀表达式(仅仅有数字和符号),可是这个后缀表达式的空格不幸丢失,如今给你一个这种后缀表达 ...

  2. ZOJ Problem Set - 1394 Polar Explorer

    这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...

  3. ZOJ Problem Set - 1025解题报告

    ZOJ Problem Set - 1025 题目分类:基础题 原题地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=10 ...

  4. ZOJ Problem Set - 2563 Long Dominoes 【如压力dp】

    称号:ZOJ Problem Set - 2563 Long Dominoes 题意:给出1*3的小矩形.求覆盖m*n的矩阵的最多的不同的方法数? 分析:有一道题目是1 * 2的.比較火.链接:这里 ...

  5. ZOJ Problem Set - 3593 拓展欧几里得 数学

    ZOJ Problem Set - 3593 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3593 One Person ...

  6. ZOJ Problem Set - 2297 Survival 【状压dp】

    题目:ZOJ Problem Set - 2297 Survival 题意:给出一些怪,有两个值,打他花费的血和能够添加的血,然后有一个boss,必须把小怪全部都打死之后才干打boss,血量小于0会死 ...

  7. ZOJ Problem Set - 3820 Building Fire Stations 【树的直径 + 操作 】

    题目:problemId=5374" target="_blank">ZOJ Problem Set - 3820 Building Fire Stations 题 ...

  8. ZOJ Problem Set - 3229 Shoot the Bullet 【有上下界网络流+流量输出】

    题目:problemId=3442" target="_blank">ZOJ Problem Set - 3229 Shoot the Bullet 分类:有源有汇 ...

  9. ZOJ Problem Set - 3822Domination(DP)

    ZOJ Problem Set - 3822Domination(DP) problemCode=3822">题目链接 题目大意: 给你一个n * m的棋盘,每天都在棋盘上面放一颗棋子 ...

随机推荐

  1. Zookeeper:Zookeeper集群概要

    1.下载解压zookeeper 使用官网的(http://zookeeper.apache.org/releases.html#download)推荐下载镜像https://mirrors.tuna. ...

  2. python类的多态、多态性

    多态:多态指的是一类事物有多种形态 多态性: class Animal: def run(self): raise AtrributeError("子类必须实现这种方法") cla ...

  3. my_note

    1.C# $ 内插字符串 Console.WriteLine($"The value of pi is {Math.PI}"); 替代string.format 2. switch ...

  4. 根据xml文件生成javaBean

    原 根据xml文件生成javaBean 2017年08月15日 18:32:26 吃完喝完嚼益达 阅读数 1727 版权声明:本文为博主原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出 ...

  5. Mac中iterm2显示彩色

    Mac中iterm2显示彩色 2016年08月23日 18:09:37 Sun7_She 阅读数:1974   参考网址:https://segmentfault.com/q/101000000065 ...

  6. 小技巧——直接在目录中输入cmd然后就打开cmd命令窗口

    直接在目录中输入cmd然后就打开cmd命令窗口

  7. luogu P4194 矩阵

    嘟嘟嘟 先二分. 令二分的值为\(mid\),则对于每一行都要满足\(|\sum_{i = 1} ^ {n} (A_{ij} - B_{ij})|\),把绝对值去掉,就得到了\((\sum_{i = ...

  8. python一些问题

    1.对于字符变量来说不需要深度复制,字符变量是不能改变的 2.文件读取结尾的判断是通过判读 line=self.fd.readline() if not line: //结束了 不用通过判断字符长度. ...

  9. GC 老年代 新生代

    参考资料: http://blog.csdn.net/flamezyg/article/details/44673951 http://www.blogjava.net/ldwblog/archive ...

  10. 【MAC工具】手机抓包工具之 —— whistle

    本文链接:https://blog.csdn.net/weixin_42534940/article/details/88783455安装参考: https://github.com/avwo/whi ...