现在的位置: 首页 > 综合 > 正文

Jugs

2013年09月03日 ⁄ 综合 ⁄ 共 540字 ⁄ 字号 评论关闭

http://www.bnuoj.com/bnuoj/contest_show.php?cid=2322#problem/25808

#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<algorithm>
#include<bitset>

using namespace std;

int main()
{
	int juga , jugb , n , t ;
	while( ~scanf( "%d%d%d" , &juga , &jugb , &n) )
	{
		if( jugb == n )
		{
			printf( "fill B\n" ) ;
			printf( "success\n" ) ;
			continue ;
		}
		if( juga == n )
		{
			printf( "fill A\n" ) ;
			printf( "pour A B\n" ) ;
			printf( "success\n" ) ;
			continue ;
		}
		t = 0 ; 
		while( t != n )
		{
			printf( "fill A\n" ) ;
			printf( "pour A B\n" ) ;
			t += juga ;
			if( jugb < t )
			{
				t -= jugb ;
				printf( "empty B\n" ) ;
				printf( "pour A B\n") ;
			}
		}
		printf( "success\n" );
	}
	return 0 ;
}

抱歉!评论已关闭.