ZOJ Problem Set - 1005
注意,条件:B>=C 。应考虑B=C的情况。
- #include<iostream>
- using namespace std;
- int A,B,C;
- void jugs(int a,int b,int C)
- {
- if(b==C)
- {
- cout<<"success"<<endl;
- }
- else if(b==B)
- {
- cout<<"empty B"<<endl;
- jugs(a,,C);
- }
- else if(a==)
- {
- cout<<"fill A"<<endl;
- cout<<"pour A B"<<endl;
- if(A+b>=B)
- {
- a=A-(B-b);
- cout<<"empty B"<<endl;
- jugs(a,,C);
- }
- else
- {
- jugs(,b+A,C);
- }
- }
- else
- {
- cout<<"pour A B"<<endl;
- if(a+b>=B)
- {
- a=A-(B-b);
- cout<<"empty B"<<endl;
- jugs(a,,C);
- }
- else
- {
- jugs(,a+b,C);
- }
- }
- return;
- }
- int main()
- {
- while(cin>>A>>B>>C)
- {
- if (A==C)
- {
- cout<<"fill A"<<endl;
- cout<<"success"<<endl;
- continue;
- }
- if (B==C)
- {
- cout<<"fill B"<<endl;
- cout<<"success"<<endl;
- continue;
- }
- jugs(,,C);
- }
- return ;
- }
1.需找bug,参考:
http://www.cnblogs.com/phinecos/archive/2008/09/21/1295472.html
ZOJ Problem Set - 1005的更多相关文章
- ZOJ Problem Set - 3829Known Notation(贪心)
ZOJ Problem Set - 3829Known Notation(贪心) 题目链接 题目大意:给你一个后缀表达式(仅仅有数字和符号),可是这个后缀表达式的空格不幸丢失,如今给你一个这种后缀表达 ...
- ZOJ Problem Set - 1394 Polar Explorer
这道题目还是简单的,但是自己WA了好几次,总结下: 1.对输入的总结,加上上次ZOJ Problem Set - 1334 Basically Speaking ac代码及总结这道题目的总结 题目要求 ...
- ZOJ Problem Set - 1025解题报告
ZOJ Problem Set - 1025 题目分类:基础题 原题地址:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=10 ...
- ZOJ Problem Set - 2563 Long Dominoes 【如压力dp】
称号:ZOJ Problem Set - 2563 Long Dominoes 题意:给出1*3的小矩形.求覆盖m*n的矩阵的最多的不同的方法数? 分析:有一道题目是1 * 2的.比較火.链接:这里 ...
- ZOJ Problem Set - 3593 拓展欧几里得 数学
ZOJ Problem Set - 3593 http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3593 One Person ...
- ZOJ Problem Set - 2297 Survival 【状压dp】
题目:ZOJ Problem Set - 2297 Survival 题意:给出一些怪,有两个值,打他花费的血和能够添加的血,然后有一个boss,必须把小怪全部都打死之后才干打boss,血量小于0会死 ...
- ZOJ Problem Set - 3820 Building Fire Stations 【树的直径 + 操作 】
题目:problemId=5374" target="_blank">ZOJ Problem Set - 3820 Building Fire Stations 题 ...
- ZOJ Problem Set - 3229 Shoot the Bullet 【有上下界网络流+流量输出】
题目:problemId=3442" target="_blank">ZOJ Problem Set - 3229 Shoot the Bullet 分类:有源有汇 ...
- ZOJ Problem Set - 3822Domination(DP)
ZOJ Problem Set - 3822Domination(DP) problemCode=3822">题目链接 题目大意: 给你一个n * m的棋盘,每天都在棋盘上面放一颗棋子 ...
随机推荐
- Zookeeper:Zookeeper集群概要
1.下载解压zookeeper 使用官网的(http://zookeeper.apache.org/releases.html#download)推荐下载镜像https://mirrors.tuna. ...
- python类的多态、多态性
多态:多态指的是一类事物有多种形态 多态性: class Animal: def run(self): raise AtrributeError("子类必须实现这种方法") cla ...
- my_note
1.C# $ 内插字符串 Console.WriteLine($"The value of pi is {Math.PI}"); 替代string.format 2. switch ...
- 根据xml文件生成javaBean
原 根据xml文件生成javaBean 2017年08月15日 18:32:26 吃完喝完嚼益达 阅读数 1727 版权声明:本文为博主原创文章,遵循CC 4.0 by-sa版权协议,转载请附上原文出 ...
- Mac中iterm2显示彩色
Mac中iterm2显示彩色 2016年08月23日 18:09:37 Sun7_She 阅读数:1974 参考网址:https://segmentfault.com/q/101000000065 ...
- 小技巧——直接在目录中输入cmd然后就打开cmd命令窗口
直接在目录中输入cmd然后就打开cmd命令窗口
- luogu P4194 矩阵
嘟嘟嘟 先二分. 令二分的值为\(mid\),则对于每一行都要满足\(|\sum_{i = 1} ^ {n} (A_{ij} - B_{ij})|\),把绝对值去掉,就得到了\((\sum_{i = ...
- python一些问题
1.对于字符变量来说不需要深度复制,字符变量是不能改变的 2.文件读取结尾的判断是通过判读 line=self.fd.readline() if not line: //结束了 不用通过判断字符长度. ...
- GC 老年代 新生代
参考资料: http://blog.csdn.net/flamezyg/article/details/44673951 http://www.blogjava.net/ldwblog/archive ...
- 【MAC工具】手机抓包工具之 —— whistle
本文链接:https://blog.csdn.net/weixin_42534940/article/details/88783455安装参考: https://github.com/avwo/whi ...