| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 6245 人关注过本帖
标题:广泛版的倒水问题如何实现
取消只看楼主 加入收藏
ASCIIhaohe
Rank: 1
等 级:新手上路
帖 子:11
专家分:7
注 册:2016-5-3
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
广泛版的倒水问题如何实现
倒水问题:
有几个容量不全相等的杯子,一部分杯子里有一定量的水,要求通过有限次倒水使各杯子里的水达到一定量。
倒水规则:
每次倒水都要把本杯子的水倒完或者把被倒杯子倒满。
要求:
输入 杯子个数,容量,初始水量和末水量。//例如杯子数4,容量21 11 8 5,出事水量21 0 0 0,末水量7 7 7 0
输出 倒水步骤或者无解。

这个问题困扰我好几天了,一直没有想到解决方法,在百度贴吧还有各种c++交流群里都问了,新手不会,大神不理
搜索更多相关主题的帖子: 百度贴吧 如何 
2016-05-03 15:41
ASCIIhaohe
Rank: 1
等 级:新手上路
帖 子:11
专家分:7
注 册:2016-5-3
收藏
得分:0 
回复 2楼 rjsp
我复制下来粘贴到我的code block里,编译报错了。。。
||=== Build file: "no target" in "no project" (compiler: unknown) ===|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|1|error: variable or field 'pour' declared void|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|1|error: 'size_t' was not declared in this scope|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|1|error: expected primary-expression before 'const'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|1|error: expected primary-expression before 'const'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|1|error: expected primary-expression before 'const'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp||In function 'int main()':|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|9|error: 'pour' was not declared in this scope|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp||In function 'void pour(size_t, const unsigned int*, const unsigned int*, const unsigned int*)':|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|27|error: template argument for 'template<class> class std::allocator' uses local type 'pour(size_t, const unsigned int*, const unsigned int*, const unsigned int*)::foo'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|27|error:   trying to instantiate 'template<class> class std::allocator'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|27|error: template argument 2 is invalid|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|27|error: invalid type in declaration before '(' token|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|28|error: invalid types 'int[int]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|29|error: invalid types 'int[int]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|30|error: invalid types 'int[int]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|31|error: invalid types 'int[int]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|35|error: request for member 'size' in 'a', which is of non-class type 'int'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|37|error: invalid types 'int[size_t {aka unsigned int}]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|39|error: template argument for 'template<class> class std::allocator' uses local type 'pour(size_t, const unsigned int*, const unsigned int*, const unsigned int*)::foo*'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|39|error:   trying to instantiate 'template<class> class std::allocator'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|39|error: template argument 2 is invalid|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|39|error: invalid type in declaration before ';' token|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|40|error: invalid types 'int[size_t {aka unsigned int}]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|41|error: request for member 'push_back' in 'ret', which is of non-class type 'int'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|41|error: invalid types 'int[size_t {aka unsigned int}]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|53|error: template argument for 'template<class> class std::allocator' uses local type 'pour(size_t, const unsigned int*, const unsigned int*, const unsigned int*)::foo*'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|53|error:   trying to instantiate 'template<class> class std::allocator'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|53|error: template argument 2 is invalid|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|53|error: invalid type in declaration before 'itor'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|53|error: expected ';' before 'itor'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|53|error: 'itor' was not declared in this scope|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|53|error: request for member 'rbegin' in 'ret', which is of non-class type 'int'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|53|error: request for member 'rend' in 'ret', which is of non-class type 'int'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|53|error: expected ')' before ';' token|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|53|error: 'itor' was not declared in this scope|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|64|error: invalid types 'int[size_t {aka unsigned int}]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|66|error: invalid types 'int[size_t {aka unsigned int}]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|68|error: invalid types 'int[size_t {aka unsigned int}]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|68|error: invalid types 'int[size_t {aka unsigned int}]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|70|error: invalid types 'int[size_t {aka unsigned int}]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|84|error: request for member 'size' in 'a', which is of non-class type 'int'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|85|error: invalid types 'int[size_t {aka unsigned int}]' for array subscript|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|89|error: request for member 'push_back' in 'a', which is of non-class type 'int'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|90|error: request for member 'back' in 'a', which is of non-class type 'int'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|91|error: request for member 'back' in 'a', which is of non-class type 'int'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|92|error: request for member 'back' in 'a', which is of non-class type 'int'|
C:\Users\guokelu\Documents\code blocks\texe\daoshui.cpp|93|error: request for member 'back' in 'a', which is of non-class type 'int'|
||=== Build failed: 45 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|
2016-05-05 12:41
快速回复:广泛版的倒水问题如何实现
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013542 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved