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 sunmoonstar_love at 2005-08-08 00:47:36 on Problem 1002
In Reply To:什么意思?还是WA,仿佛在最后一个数据WA Posted by:sunmoonstar_love at 2005-08-08 00:45:37
> #include<iostream>
> #include<map>
> #include<string>
> using namespace std;
> char tmp[200];
> string s="12345678";
> map<string,int> inch;
> map<string,int>::const_iterator iter,begin,end;
> int n,i,len;
> char key[27] = "22233344455566677778889999";
> int main()
> {
>     cin>>n;
>     while(n--)
>     {
>         cin>>tmp;
>         len = 0;
>         for(i=0; tmp[i]!=0; i++)
>         {
>             if(len==3)
>                 s[len++] = '-';
>             if(tmp[i]<='9'&&tmp[i]>='0')
>                 s[len++] = tmp[i];   
>             else
>                 if(tmp[i]<'Z'&&tmp[i]>='A')
>                     s[len++] = key[tmp[i]-'A'];
>         }    
>         if(inch.find(s)==inch.end())
>             inch[s] = 1;
>         else
>             inch[s] += 1;    
>     }
>     begin = inch.begin();
>     end = inch.end();
>     while(begin!=end)
>     {
>         if(begin->second>1)  
>             cout<<begin->first<<" "<<begin->second<<endl;  
>         begin++;
>     }   
>  //   system("pause");        
>     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