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 |
Re:map不是更快么?In Reply To:Re:map不是更快么? Posted by:MasterLuo at 2008-07-16 21:59:42 > #include <iostream> > #include <map> > #include <algorithm> > using namespace std; > > int n, a[5]; > long long int s=0; > int main() > { > map<long long int, int>::iterator itr; > while(scanf("%d", &n) && n!=0) > { > int max=0, result=0; > map<long long int, int> _map; > for(int t=0; t<n; t++) > { > for(int i=0; i<5; i++) > scanf("%d", &a[i]); > s=0; > sort(a, a+5); > for(int i=0; i<5; i++) > s=s*1000+a[i]; > _map[s]++; > if(_map[s]>max) > max=_map[s]; > } > for(itr=_map.begin(); itr!=_map.end(); itr++) > if(itr->second==max) > result+=max; > printf("%d\n", result); > } > return 0; > } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator