Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
贴代码,模拟#include <iostream> using namespace std; int main() { int ca,cb,n; while (cin >> ca >> cb >> n) { int bnow; int b = 0; while (b != n) { for (int i = 0;i <= (cb - b) / ca;i++) { cout << "fill A" << endl; cout << "pour A B" << endl; bnow = b + ca * (i + 1); if (bnow == n) { break; } } if (bnow == n) { break; } cout << "empty B" << endl; int a; a = ca - (cb - b) % ca; cout << "pour A B" << endl; b = a; if (b == n) { break; } } cout << "success" << endl; } return 0; } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator