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

为什么会超时呢?帮我看一下,谢了。(附代码)

Posted by youxirenjian163 at 2009-03-15 15:54:19 on Problem 2608
#include <iostream>
#include<memory.h>
using namespace std;

int main()
{
    int map[256]={0};
    char a,b;
    map['B'] = map['F'] = map['P'] = map['V'] = 1;
    map['C'] = map['G'] = map['J'] = map['K']= map['Q'] = map['S'] = map['X'] = map['Z'] = 2;
    map['D'] = map['T'] = 3;
    map['L'] = 4;
    map['M'] = map['N'] = 5;
    map['R'] = 6;
    while(a=getchar())
    {
        if(map[a]==map[b])
        {

        }
        else if((a!='\n')&&(map[a]!=0))
        {
            printf("%d",map[a]);
        }
        else if(a=='\n')
        {
            printf("\n");
        }
        b=a;
    }
    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