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 |
提交时去掉了freopen和getch么?In Reply To:为什么啊,为什么WA?都做了1天了~:( Posted by:adamgic at 2005-04-16 17:01:01 > #include <iostream> > #include <vector> > #include <stdlib.h> > #include <ctype.h> > #include <conio.h> > using namespace std; > string str; > int Nums[100000]; > const int pows[7]={1000000,100000,10000,1000,100,10,1}; > const int x[26]={2,2,2,3,3,3,4,4,4,5,5,5,6,6,6,7,7,7,7,8,8,8,9,9,9,9}; > int main(void) > { > freopen("input1002.in","r",stdin); > int Numbers; > cin>>Numbers; > for(int i=0;i<Numbers;i++){ > cin>>str; > Nums[i]=0; > int bits=6; > for(int j=0;j<str.length();j++) > { > if(str[j]=='-')continue; > if(isdigit(str[j])){Nums[i]+=(str[j]-48)*pows[6-bits];bits--;continue;} > if(isalpha(str[j])){Nums[i]+=x[str[j]-65]*pows[6-bits];bits--;continue;} > } > } > sort(Nums,&Nums[Numbers]); > int temp(0),times(1); > int dups=0; > for(int i=0;i<Numbers;i++) > { > if(Nums[i]==temp){++times;++dups;} > else { > if(times>1) > cout<<Nums[i-1]/1000000<<Nums[i-1]%1000000/100000<<Nums[i-1]%100000/10000<< > "-"<<Nums[i-1]%10000/1000<<Nums[i-1]%1000/100<<Nums[i-1]%100/10<<Nums[i-1]%10<<" "<<times<<endl; > temp=Nums[i]; > times=1; > } > } > if(!dups)cout<<"No duplicates."<<endl; > getch(); > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator