• 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] = '';
                printf ("%s %.3f
    ",sss, people[i].score);
                //cout << people[i].name << " " << people[i].score << endl;
            }
        }
        return 0;
    }
  • 相关阅读:
    zabbix实现原理及架构详解
    用Python玩转微信(一)
    你真的用好了Python的random模块吗?
    Authentication of Django
    Django admin 权威指南(一)
    常用查找数据结构及算法(Python实现)
    基于python的七种经典排序算法
    Django 1.10 中文文档------3.2.2 查询操作making queries
    “全能”选手—Django 1.10文档中文版Part4
    Django 1.10 中文文档------3.2.1 模型Models
  • 原文地址:https://www.cnblogs.com/wushuaiyi/p/4439348.html
Copyright © 2020-2023  润新知