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

500多MS怎么和楼下几楼的差距这么大。。。想不通。。

Posted by luishen at 2010-08-02 17:28:50 on Problem 1002
#include <iostream>
using namespace std;
int tel[10000001]={0};
int into_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 ()
{  
  char c[100];
  int i;
  int temp;
  int testcase;
         scanf("%d",&testcase);
     while ( testcase-- )
	 {
		 scanf("%s",&c);
		i=0;
		temp=0;

		while (c[i]!='\0')
		{		if  (c[i]>='0'&&c[i]<='9')
				temp=temp*10+c[i]-'0';
		
			else if (c[i]>='A'&&c[i]<='P' || c[i]>='R'&& c[i]<='Y')
					temp=temp*10+into_num[c[i]-'A'];
			i++;
			
		}
		//printf("%d\n",temp);
		tel[temp]++;
	 }

      int flag=0;
      for( i=0; i<=10000000; i++)
		  if (tel[i]>1)
		  {
			  flag=1;
			  printf("%03d-%04d %d\n",i/10000,i%10000,tel[i]);
		  }
	     if (!flag)
			 printf("No duplicates.\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