POJ 1472 Instant Complexity G++ 递归 没掌握

POJ 1472 Instant Complexity G++ 递归 没掌握_第1张图片

POJ 1472 Instant Complexity G++ 递归 没掌握_第2张图片

POJ 1472 Instant Complexity G++ 递归 没掌握_第3张图片

#include 
#include 
#include 
#include 
#include  
#include  
using namespace std;
//英语      看博友分析    抄博友程序     递归     没掌握 
//int mi[20];
//stack lo;
//stack op;
const int N = 12;
int deal(int* mi)
{
	char ch[100];
	scanf("%s",ch);
	if(ch[0]=='E')
	{
		return 0;
	}
	if(ch[0]=='B')
	{
		while(deal(mi));//重要 
	}else if(ch[0]=='L')
	{
		scanf("%s",ch);
		int t=-1,tmp[N]={0};//
		if(ch[0]!='n')
		{
			t=atoi(ch);
		}
		while(deal(tmp));//重要 
		if(t==-1)
		{
			for(int i=11;i>=1;i--)
			{
				tmp[i]=tmp[i-1];
			}
			tmp[0]=0;
		}else
		{
			for(int i=11;i>=0;i--)
			{
				tmp[i]*=t;
			}
		}
		for(int i=11;i>=0;i--)
		{
			mi[i]+=tmp[i];
		}
	}else
	{
		scanf("%s",ch);
		mi[0]+=atoi(ch);
		return deal(mi);
	}
	return 1;
}
int main()
{
	int T;
	cin>>T;
	int tag=0;
	while(T--)
	{
		tag++;
		int mi[N]={0};
		deal(mi); 
		/*
		int js=0;//栈实现 wa		
		while(lo.empty()!=1)
		{
			lo.pop();
		}
		while(op.empty()!=1)
		{
			op.pop();
		}
		int sum=0;
		int flag=0;//最里层 
		while(1)
		{
			string s;
			cin>>s;
			if(s=="BEGIN")
			{
				js++;
				lo.push("1");
			}else if(s=="END")
			{
				js--;
				int x;
				if(flag==0)
				{
					flag=1;
					x=0;
				}else
				{
					x=op.top();
					op.pop();					
				}
				int y=sum;				
				mi[0]=mi[0]+x+y;
				//cout<=1;i--)
					{
						mi[i]=mi[i-1];
					}
					mi[0]=0;
				}else
				{
					int b=0;
					for(int i=0;i=0;i--)
					{
						mi[i]=mi[i]*b;
					}
				}
				
				//for(int i=0;i<=10;i++)
				//{
				//	cout<>a;
				lo.push(a);
				op.push(sum);
				//cout<>a;
				sum=sum+a;				
			}
			if(js==0)
			{
				break;
			}
		}*/
		cout<<"Program #"<

 

你可能感兴趣的:(POJ,有程序,其他POJ没程序,POJ1400-1499,先读一遍英文,难受的时候多)