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

special judge..不用bfs 直接模拟即可

Posted by suicid at 2010-06-24 19:14:29 on Problem 1606
#include"iostream"
using namespace std;
int main(){
    int ca,cb,n,a,b;
    while(scanf("%d%d%d",&ca,&cb,&n)!=EOF){
         a=b=0;
         while(b!=n){
            if(b==cb){
               printf("empty B\n");
               b=0;
            }
            else if(a==0){
               printf("fill A\n");
               a=ca;
            }
            else{
               printf("pour A B\n");
               b+=a;
               a=0;
               if(b>cb){
                  a+=b-cb;
                  b=cb;
               }
            }
         }
         printf("success\n");
    }
    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