ZOJ 3705 Applications Simulation

Source: Internet
Author: User

The description of the topic is very well understood.

Not a difficult simulation problem, there is no pit, clear thinking can be.

(A ding seniors in the year before the provincial game collapsed in this simulation, in fact, think well or can be a

//#pragma COMMENT (linker, "/stack:16777216")//For C + + Compiler#include <stdio.h>#include<iostream>#include<fstream>#include<cstring>#include<cmath>#include<stack>#include<string>#include<map>#include<Set>#include<list>#include<queue>#include<vector>#include<algorithm>#defineMax (b) ((a) > (b))? (a): (b))#defineMin (b) ((a) < (a))? (a): (b))#defineAbs (x) (((x) > 0)? (x): (-(x)))#defineMOD 1000000007#definePi ACOs (-1.0)using namespaceStd;typedefLong Longll; typedef unsignedLong Longull; typedef unsignedint        UINT; typedef unsignedCharUchar; template<classT> InlinevoidCheckmin (T &a,t b) {if(a>b) a=b;} Template<classT> InlinevoidCheckmax (T &a,t b) {if(a<b) a=b;}Const DoubleEPS = 1e-7      ;Const intN = About            ;Constll P =10000000097ll;Const intMAXN =10900000    ;intN, M;map<int,int>M;map<int,int>O;map<string,int>T;structSC {stringsex; stringteam; stringname; Doublescore;} people[ -];BOOLPrime (intnum) {    if(num = =1|| num = =2)return true;  for(inti =2; I <= sqrt (num); ++i) {if(num% i = =0)return false; }    return true;}BOOLCMP (ConstSC & A,ConstSC &b) {returnA.score >B.score;}intMain () {Std::ios::sync_with_stdio (false); intI, J, T, K, U, V, numcase =0; CIN>>T;  while(t--) {m.clear ();        O.clear ();        T.clear (); CIN>> N >>m; intnum; CIN>>num;  while(num--) {cin>>u; M[u]=1; } CIN>>num;  while(num--) {cin>>u; O[u]=1; }        intQ; CIN>>Q;  while(q--) {            stringstr; CIN>> Str >>num; T[STR]=num; }         for(k =0; K < n; ++k) {cin>> people[k].name >> people[k].team >> people[k].sex >> u >>v; People[k].score=0; if(People[k].sex.compare ("F") ==0) People[k].score + =33.0; if(T[people[k].team] = =1) {People[k].score+=36.0; } Else if(T[people[k].team] = =2) {People[k].score+=27.0; } Else if(T[people[k].team] = =3) {People[k].score+=18.0; }             for(i =0; i < U; ++i) {cin>>num; if(M[num]) {People[k].score+=2.5; } Else if(O[num]) {People[k].score+=1.5; } Else if(Prime (num)) {People[k].score+=1.0; } Else{People[k].score+=0.3; }            }            intarrayi[ -];  for(i =0; I < V; ++i) {cin>>Arrayi[i]; } sort (Arrayi, Arrayi+v); if(V <3) {num=0; } Else{num= Arrayi[v-3]; } People[k].score+ = Max (0, (Num- -) /100.0) *1.5; } sort (people, people+N, CMP);  for(i =0; I < m; ++i) {Charsss[ -];  for(j =0; J < People[i].name.size (); ++j) {Sss[j]=People[i].name[j]; } Sss[j]=' /'; printf ("%s%.3f\n", SSS, People[i].score); //cout << people[i].name << "<< people[i].score << Endl;        }    }    return 0;}

ZOJ 3705 Applications Simulation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.