Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
看看我的代码,为森么是WA??????指教指教吧,各位大神,,,#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: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator