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 skywhat at 2015-09-12 11:19:48 on Problem 1002
WTF,好坑爹。
我把cin改成scanf就过了,本来是Time Limit Exceeded

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<map>
#include<set>
#include<cstring>
using namespace std;
int num[]=
{
    2,2,2,
    3,3,3,
    4,4,4,
    5,5,5,
    6,6,6,
    7,0,7,7,
    8,8,8,
    9,9,9
};

int main()
{
    map<int,int> tel;
    int i;
    int count;
    scanf("%d",&count);
    while(count--)
    {
        int c=0;
        char buf[128];
        cin>>buf;
        for(i=0;buf[i];++i)
        {
            if(isdigit(buf[i]))
                c=10*c+buf[i]-'0';
            else if(isalpha(buf[i]))
                c=10*c+num[buf[i]-'A'];
                
        }
        tel[c]++;
    }
    map<int,int>::iterator it=tel.begin();
    bool flag=true;
    while(it!=tel.end())
    {
        if((*it).second>1)
        {
            flag=false;
            printf("%03d",(*it).first/10000);
            printf("-");
            printf("%04d",(*it).first%10000);
            printf(" %d\n",(*it).second);
        }
        it++;
    }
    if(flag)
        cout<<"No duplicates."<<endl;
    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