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

Re:WA……HELP

Posted by zzyzzy12 at 2010-11-28 15:49:56 on Problem 2608 and last updated at 2010-11-28 15:51:16
In Reply To:WA……HELP Posted by:mickeyandkaka at 2010-11-12 21:02:00
写了这么多..呃..看着有点晕..
没必要用这么多if吧..上面定义个数组就行了..
附上我的AC代码...
#include<iostream>
using namespace std;
int a[27]={0,0,1,2,3,0,1,2,0,0,2,2,4,5,5,0,1,2,6,2,3,0,1,0,2,0,2};
char s[100];
int k;
int main()
{
  while (gets(s)!=0)
  {
    for (k=0;k<strlen(s);k++)
    if (a[s[k]-'A'+1]!=0)    
    if (a[s[k]-'A'+1]!=a[s[k+1]-'A'+1]) printf("%d",a[s[k]-'A'+1]);
    printf("\n");
  } 
  return 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