Title Link: http://acm.nyist.net/JudgeOnline/problem.php?pid=251
Rules:
1. If a bid price is unique, the winner
2, if there is no unique bid price, the bid is the lowest bidder bid price, there are many, choose the cheapest price and the first to vote for the bid
#include <iostream>#include<cstdio>#include<cstring>using namespacestd;#defineN 102#defineM 1002structnode{Charname[6]; intp;} C[n];intCntp[m];intMain () {//freopen ("D:\\in.txt", "R", stdin); ints, N; while(cin>>s>>N) {memset (CNTP,0,sizeof(CNTP)); for(intI=0; i<n; i++) {cin>>c[i].name>>C[I].P; CNTP[C[I].P]++; } intMINP =M, K; for(intI=1; i<= +; i++){ if(Cntp[i] && cntp[i]<MINP) {MINP=Cntp[i]; K=i; } } inti; for(i=0; i<n; i++){ if(C[I].P = =k) Break; } printf ("The winner is%s\nthe Price is%d\n", C[i].name, C[I].P); } return 0;}
[Henan Province ACM Province-third session] Amazing AUCTION (Nyoj 251)