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

为什么time exceed limited?

Posted by A0317170 at 2003-10-21 21:46:21 on Problem 1002
#include <iostream>

using namespace std;

void main()
{
	int dial_number;
	cin>>dial_number;
	int *dial=new int[dial_number];
	for (int j=0;j<dial_number;j++)
	{
		int num=0;
		int i=0;
	
		do{
			char a;  int b=10;
			cin>>a;
			switch(a){
				case'0':b=0;break;
				case '1':b=1;break;
				case '2':
				case 'A':
				case 'B':
				case 'C':b=2;break;
				case'3':
				case 'D':
				case 'E':
				case 'F':b=3;break;
				case'4':
				case 'G':
				case 'H':
				case 'I':b=4;break;
				case '5':
				case 'J':
				case 'K':
				case 'L':b=5;break;
				case '6':
				case 'M':
				case 'N':
				case 'O':b=6;break;
				case '7':
				case 'P':
				case 'R':
				case 'S':b=7;break;
				case '8':
				case 'T':
				case 'U':
				case 'V':b=8;break;
				case '9':
				case 'W':
				case 'X':
				case 'Y':b=9;break;
				default: ;
		}
		if (b!=10)
			{num=10*num+b;
			i++;}
		}	
	while(i<7);
	dial[j]=num;}

	for(int n=0;n<dial_number;n++)
		for(int k=n+1;k<dial_number;k++)
			if ( dial[n]>dial[k]){int x=dial[k]; dial[k]=dial[n];dial[n]=x;}

	for(int y=0;y<dial_number;y++)
	{	int m=0;	
		while(dial[y]==dial[y+1])
			{++m;++y;}
		if (m>0)
		cout<<dial[y]/10000<<"-"<<dial[y]%10000<<" "<<m+1<<endl;
	}
}

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