The Blocks Problem UVA101

#include
#include
#include
#include
using namespace std;
const int maxn = 30;
int n;
vector pile[maxn];
void find_block(int a,int &p,int &h){
	for(p = 0;p>n;
	string s1,s2;
	for(int i = 0;i>s1>>a>>s2>>b){
		int pa,pb,ha,hb;
		find_block(a,pa,ha);
		find_block(b,pb,hb);
		if(pa == pb) continue;
		if(s2 == "onto") clear_above(pb,hb);
		if(s1 == "move") clear_above(pa,ha);
		pile_onto(pa,ha,pb);
 	}
 	print();
 	return 0;
}

 

你可能感兴趣的:(The Blocks Problem UVA101)