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

嘿嘿。ac了

Posted by zhangkeabcd at 2010-08-09 10:47:06 on Problem 2608
#include<iostream>
#include<string.h>
using namespace std;
char s[21];
int main()
{
	int m,i;
	char c;
	while(gets(s))
	{
		int k=0;
		m=strlen(s);
		for(i=0;i<m;i++)
		{
			if(k!=1&&(s[i]=='B'||s[i]=='F'||s[i]=='P'||s[i]=='V'))
			{
				cout<<1;
				k=1;
				continue;
			}
			if(k!=2&&(s[i]=='C'||s[i]=='G'||s[i]=='J'||s[i]=='K'||s[i]=='Q'||s[i]=='S'||s[i]=='X'||s[i]=='Z'))
			{
				cout<<2;
				k=2;
				continue;
			}
			if(k!=3&&(s[i]=='D'||s[i]=='T'))
			{
				cout<<3;
				k=3;
				continue;
			}
			if(k!=4&&s[i]=='L')
			{
				cout<<4;
				k=4;
				continue;
			}
			if(k!=5&&(s[i]=='M'||s[i]=='N'))
			{
				cout<<5;
				k=5;
				continue;
			}
			if(k!=6&&s[i]=='R')
			{
				cout<<6;
				k=6;
				continue;
			}
			if(s[i]=='A'||s[i]=='E'||s[i]=='I'||s[i]=='O'||s[i]=='U'||s[i]=='H'||s[i]=='W'||s[i]=='Y')
				k=0;
		}
		cout<<endl;
	}
	return 0;
}
第一次wa了。原因是最后一个if写成了else,然后就直接在else下令k=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