ZOJ 3705 Applications 模拟

题目的描述非常好理解。

不算难的模拟题,也没有坑,思路清晰即可。

 

(某丁学长在前年省赛时萎在这道模拟,其实好好想还是可以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>
#define Max(a,b) (((a) > (b)) ? (a) : (b))
#define Min(a,b) (((a) < (b)) ? (a) : (b))
#define Abs(x) (((x) > 0) ? (x) : (-(x)))
#define MOD 1000000007
#define pi acos(-1.0)

using namespace std;

typedef long long           ll      ;
typedef unsigned long long  ull     ;
typedef unsigned int        uint    ;
typedef unsigned char       uchar   ;

template<class T> inline void checkmin(T &a,T b){if(a>b) a=b;}
template<class T> inline void checkmax(T &a,T b){if(a<b) a=b;}

const double eps = 1e-7      ;
const int N = 210            ;
const ll P = 10000000097ll   ;
const int MAXN = 10900000    ;

int n, m;

map <int, int> M;
map <int, int> O;
map <string, int> T;

struct sc {
    string sex;
    string team;
    string name;
    double score;

} people[600];

bool prime (int num) {
    if (num == 1 || num == 2)   return true;
    for (int i = 2; i <= sqrt (num); ++i) {
        if (num % i == 0)   return false;
    }
    return true;
}

bool cmp (const sc & a, const sc & b) {
    return a.score > b.score;
}

int main(){
    std::ios::sync_with_stdio(false);
    int i, j, t, k, u, v, numCase = 0;

    cin >> t;
    while (t--) {
        M.clear ();
        O.clear ();
        T.clear ();
        cin >> n >> m;
        int num;
        cin >> num;
        while (num--) {
            cin >> u;
            M[u] = 1;
        }
        cin >> num;
        while (num--) {
            cin >> u;
            O[u] = 1;
        }
        int Q;
        cin >> Q;
        while (Q--) {
            string str;
            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;
                }
            }
            int arrayi[1200];
            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 - 1200) / 100.0) * 1.5;

        }

        sort (people, people + n, cmp);

        for (i = 0; i < m; ++i) {
            char sss[300];
            for (j = 0; j < people[i].name.size (); ++j) {
                sss[j] = people[i].name[j];
            }
            sss[j] = \0;
            printf ("%s %.3f\n",sss, people[i].score);
            //cout << people[i].name << " " << people[i].score << endl;
        }
    }
    return 0;
}

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。