• HDU 1940


    //比赛的时候卡了三个点。今天卡了两个点。真心不愿意再看了。

    // 自己按照直线相交的思路的敲得。题意里说了不是按照final rank 给的。但是。这样就和标程输出不同。

    //就是觉得AC突然就不那么重要了。也只是揣摩出题人的意思。好无聊。

    #include<stdio.h>
    #include<iostream>
    #include<string.h>
    #include<algorithm>
    using namespace std;
    
    int maxn = 0x1f1f1f1f;
    int minn = 0;
    
    int item[1200];
    int fa[1200];
    int a[1200];
    int b[1200];
    int num[1200];
    int ac[1200];
    
    int get(char s[])
    {
        int num = 0;
        int len = strlen(s);
        for (int i=0; i<len; ++i)
        {
            num = num * 10 + s[i] - '0';
        }
        return num;
    }
    
    int main()
    {
        int t, p;
        int ci;
        char temp, time[500];
        while(~scanf("%d%d", &t, &p))
        {
            maxn = 0x1f1f1f1f;
            minn = 1;
            if (t == 0 && p == 0)
                break;
            memset(item, 0, sizeof(item));
            memset(a, 0, sizeof(a));
            memset(b, 0, sizeof(b));
            memset(fa, 0, sizeof(fa));
            memset(num, 0, sizeof(num));
            memset(ac, 0, sizeof(ac));
    
            for (int i=0; i<t; ++i)
            {
                for (int j=0; j<p; ++j)
                {
                   scanf("%d", &ci);
                   getchar();
                   scanf("%s", time);
                   if (ci == 0)
                    continue;
                   if (time[0] == '-')
                       continue;
                    else
                    {
                        item[i] += 1;
                        int sco = get(time);
                        fa[i] += (sco + (ci - 1) * 20);
                        a[i] += (ci-1);
                        b[i] += sco;
                        num[i] = i+1;
                        if (ci == 1)
                        ac[i] += 1;
                    }
                }
            }
    
            for (int i=0; i<t; ++i)
            {
                if (item[i] == 0) continue;
                if (fa[i] == 0) continue;
                for (int j=0; j<t; ++j)
                {
                    if (item[j] == 0) continue;
                    if (item[i] != item[j]) continue;
                    if (a[i] == a[j]) continue;
                    if (fa[j] == 0) continue;
                    double t = (b[i] - b[j]) * 1.0 / (a[j] - a[i]);
                    int rs, rb;
                    if (fa[i] > fa[j])
                    {
                        rs = j;
                        rb = i;
                    }
                    else if (fa[i] < fa[j])
                    {
                        rs = i;
                        rb = j;
                    }
                    else if (fa[i] == fa[j])
                    {
                        minn = maxn = 20;
                        continue;
                    }
                    if (a[rs] > a[rb])
                    {
                         if (t<maxn)
                        {
                           if (t == int(t))
                              maxn = t - 1;
                           else maxn = int(t);
                        }
                        if (num[rs] < num[rb] && t == int(t))
                            maxn += 1;
                    }
                    else if (a[rs] < a[rb])
                    {
                        minn = int (t + 1);
                        if (num[rs] < num[rb] && t == int(t))
                            minn -= 1;
                    }
                }
            }
            if (minn <= 0)
                minn = 1;
            printf("%d ", minn);
            if (maxn == 0x1f1f1f1f)
            {
                printf("*
    ");
            }
            else printf("%d
    ", maxn);
        }
        return 0;
    }
    LOoK



  • 相关阅读:
    Could not find package vendor/name in a version matching v-Number 是坑!
    Magento 2 Error: A technical problem with the server created an error. Try again to continue what you were doing. If the problem persists, try again later.
    七牛Qshell 常用命令打印
    VBA
    XUGUO-书呆子-搜索书箱
    Magento2 API 服务合同设计模式 依赖注入 介绍
    Magento2 Service contracts 服务合同
    Magento2自定义命令
    在Magento 2中创建管理员菜单
    Routing 为 Magento 2 一个重要的部分,本文介绍基本应用
  • 原文地址:https://www.cnblogs.com/icode-girl/p/4674110.html
Copyright © 2020-2023  润新知