Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

贴代码,模拟

Posted by lisency at 2012-03-25 17:25:07 on Problem 1606
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator