ZOJ-3705-Applications

大模拟,注意1.5*max(0.0, 1.0*(a[2]-1200)/100)这里,如果是int a[ ] 的不要 /100, 要 *0.01

#include <stdio.h>
#include <algorithm>
#include <iostream>
#include <string.h>
#include <stdlib.h>
#include <queue>
#include <vector>
#include <math.h>
#include <stack>
#include <map>
#define rtl rt<<1
#define rtr rt<<1|1
typedef long long LL;
using namespace std;
const int MAX = 15000+10;
const double eps = 1e-10;
const double PI = acos(-1.0);
int t, n, m;
double a[MAX];
int numa, numb, numt, score, num1, num2, id;
string teamname, sex;
map<string, int>team;
map<int, double>pro;
struct node
{
    string name;
    double ans;
}lxt[MAX];
bool su(int x)
{
    for(int i = 2; i<x/2; ++i)
        if(x%i==0)return 0;
    return 1;
}
bool cmp1(double a, double b)
{
    return a>b;
}
bool cmp(node a, node b)
{
    if(a.ans!=b.ans)return a.ans>b.ans;
    return a.name<b.name;
}
int main()
{
    scanf("%d", &t);
    while(t--)
    {
        team.clear();
        pro.clear();
        cin>>n>>m;
        cin>>numa;
        for(int i = 0; i<numa; ++i)
        {
            scanf("%d", &id);
            pro[id] = 2.5;
        }
        cin>>numb;
        for(int i = 0; i<numb; ++i)
        {
            scanf("%d", &id);
            pro[id] = 1.5;
        }
        cin>>numt;
        for(int i = 0; i<numt; ++i)
        {
            cin>>teamname>>score;
            team[teamname] = score;
        }
        for(int i = 0; i<n; ++i)
        {
            lxt[i].ans = 0.0;
            cin>>lxt[i].name>>teamname>>sex>>num1>>num2;
            for(int j = 0; j<num1; ++j)
            {
                scanf("%d", &id);
                if(pro[id])lxt[i].ans+=pro[id];
                else if(su(id))lxt[i].ans+=1.0;
                else lxt[i].ans+=0.3;
            }//printf(" %.3f\n", lxt[i].ans);
            if(team[teamname]==1)lxt[i].ans+=36.0;
            else if(team[teamname]==2)lxt[i].ans+=27.0;
            else if(team[teamname]==3)lxt[i].ans+=18.0; //printf(" %.3f\n", lxt[i].ans);
            for(int j = 0;j<num2; ++j)
               cin>>a[j];
            if(num2>=3)
            {
                sort(a, a+num2, cmp1);
                lxt[i].ans+=1.5*max(0.0, 1.0*(a[2]-1200)/100);//printf(" %.3f\n", lxt[i].ans);
            }
            if(sex=="F")lxt[i].ans+=33.0;
         // printf(" %.3f\n", lxt[i].ans);
        }
        sort(lxt, lxt+n, cmp);
        for(int i = 0; i<min(m, n); ++i)
        {
            cout<<lxt[i].name;
            printf(" %.3f\n", lxt[i].ans);
        }
    }
    return 0;
}


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值