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

看看我的代码,为森么是WA??????指教指教吧,各位大神,,,

Posted by 1006840622 at 2013-03-07 11:57:47 on Problem 1002
#include <iostream>
#include <String>
using namespace std;

int Marry[10000000];
int Trans[100];
string s;
int n;
int value;
int flag=0;
int Max=-1;
int Min=10000001;
int main()
{
	memset(Trans,0,sizeof(Trans));
	memset(Marry,0,sizeof(Marry));
	Trans['0']=0;
	Trans['1']=1;
	Trans['2']=Trans['A']=Trans['B']=Trans['C']=2;
	Trans['3']=Trans['D']=Trans['E']=Trans['F']=3;
	Trans['4']=Trans['G']=Trans['H']=Trans['I']=4;
	Trans['5']=Trans['J']=Trans['K']=Trans['L']=5;
	Trans['6']=Trans['M']=Trans['N']=Trans['O']=6;
	Trans['7']=Trans['P']=Trans['R']=Trans['S']=7;
	Trans['8']=Trans['T']=Trans['U']=Trans['V']=8;
	Trans['9']=Trans['W']=Trans['X']=Trans['Y']=9;	
	n=0;
	cin>>n;
	
	while(n--)
	{
		value=0;
		s.erase();
		cin>>s;
		for(int i=0;i<s.length();i++)
		{
			if(s[i]!='-')
			{
				value=value*10+Trans[s[i]];
			}
		}
		Marry[value]++;
		if(value>Max)
			Max=value;
		if(value<Min)
			Min=value;
	}

	for(int i=Min;i<=Max;i++)
	{
		if(Marry[i]>1)
		{
			flag=1;
			if(i>1000000)
			{
				cout<<i/10000;
			}
			else
			{
				cout<<0<<i/10000;
			}
			cout<<'-'<<i%10000<<' '<<Marry[i]<<endl;
		}
	}

	if(flag!=1)
		cout<<"No duplicates."<<endl;
	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