POJ 2658 Song G++

 

#include <iostream>
#include <string>
using namespace std;
//好好学英语 
int main()
{
	int NUM;
	cin>>NUM;
	string a[NUM][4];
	string jg[NUM][4];
	string c;
	getline(cin,c);
	for(int i=0;i<NUM;i++)
	{
		for(int j=0;j<4;j++)
		{
			getline(cin,a[i][j]);
			int hi=0;
			for(int k=a[i][j].size()-1;k>=0;k--)
			{
				if((a[i][j][k]>='A')&&(a[i][j][k]<='Z'))//变成小写字母 
				{
					a[i][j][k]=a[i][j][k]+32;
				}
				if((a[i][j][k]=='a')
				//||(a[i][j][k]=='A')
				||(a[i][j][k]=='i')
				//||(a[i][j][k]=='I')
				||(a[i][j][k]=='e')
				//||(a[i][j][k]=='E')
				||(a[i][j][k]=='o')
				//||(a[i][j][k]=='O')
				||(a[i][j][k]=='u'))
				//||(a[i][j][k]=='U'))//A、E、I、O、U
				{
					jg[i][j]=a[i][j].substr(k);
					hi=1;
					break;	
				}else if((a[i][j][k]==' '))
				{
					jg[i][j]=a[i][j].substr(k+1);
					hi=1;
					break;	
				}
			}
			if(hi==0)
			{
				jg[i][j]=a[i][j];
			}
		}
	}
	/*
	for(int i=0;i<NUM;i++)
	{
		for(int j=0;j<4;j++)
		{
			cout<<jg[i][j]<<endl;
		}
	}*/
	for(int i=0;i<NUM;i++)
	{
		if((jg[i][0]==jg[i][1])&&(jg[i][0]==jg[i][2])&&(jg[i][0]==jg[i][3]))
		{
			cout<<"perfect"<<endl;
		}else if((jg[i][0]==jg[i][1])&&(jg[i][2]==jg[i][3]))
		{
			cout<<"even"<<endl;
		}else if((jg[i][0]==jg[i][2])&&(jg[i][1]==jg[i][3]))
		{
			cout<<"cross"<<endl;
		}else if((jg[i][0]==jg[i][3])&&(jg[i][1]==jg[i][2]))
		{
			cout<<"shell"<<endl;
		}else //if((jg[i][0]!=jg[i][1])&&(jg[i][0]!=jg[i][2])&&(jg[i][0]!=jg[i][3]))
		{
			cout<<"free"<<endl;
		}
	}
	return 0;
} 

#include <iostream>
#include <string>
using namespace std;
int main()
{
	int T;
	cin>>T;
	string t;
	getline(cin,t);
	for(int o=0;o<T;o++)
	{
		string jg[4]="";
		for(int i=0;i<4;i++)
		{
			string s;
			getline(cin,s);
			for(int j=0;j<s.size();j++)
			{
				if(s[j]>='A'&&s[j]<='Z')
				{
					s[j]=s[j]-'A'+'a';
				}
			}	
			int j;
			for(j=s.size()-1;j>=0;j--)
			{
				if(s[j]==' ')
				{
					break;
				}
			}		
			jg[i]=s.substr(j+1,s.size()+1);
			//cout<<jg[i]<<endl;
			for(int j=jg[i].size()-1;j>=0;j--)
			{
				if(jg[i][j]=='a'||jg[i][j]=='e'||jg[i][j]=='i'||jg[i][j]=='o'||jg[i][j]=='u')
				{
					char c=jg[i][j];
					//cout<<c<<endl;
					jg[i]="";
					jg[i]=jg[i]+c;
					break;
				}
			}
			//cout<<jg[i]<<endl;
		}
		if(jg[0]==jg[1] && jg[1]==jg[2] && jg[2]==jg[3])
		{
			cout<<"perfect"<<endl;
			continue;
		}else if(jg[0]==jg[1] && jg[2]==jg[3])
		{
			cout<<"even"<<endl;
			continue;
		}else if(jg[0]==jg[2] && jg[1]==jg[3])
		{
			cout<<"cross"<<endl;
			continue;
		}else if(jg[0]==jg[3] && jg[1]==jg[2])
		{
			cout<<"shell"<<endl;
			continue;
		}else 
		{
			cout<<"free"<<endl;
			continue;			
		}	
	}
	return 0;
}

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值