HDOJ1084学习输入

来源:互联网 发布:俯瞰风景 知乎 编辑:程序博客网 时间:2024/06/01 21:16

//题目连接http://acm.hdu.edu.cn/showproblem.php?pid=1084

#include<stdio.h>

#include<stdlib.h>
#include<string.h>
#include<list>
#include<iostream>
const int inf = 0x3f3f3f;
using namespace std;


int main()
{
    int n;
    while(scanf("%d",&n) && n != -1)
    {
        {
        int time[1222],scoer[1222],x[62],ans[1222],b[1222],aa,bb,cc;
        memset(x,0,sizeof(x));
        for(int i = 1 ; i <= n ; i++)
        {
            scanf("%d",&scoer[i]);//下面的那种输入方法注意学习.
             scanf("%d:%d:%d",&aa,&bb,&cc);//妈的,他的题目给的都是09:23:23
             if(scoer[i] == 5)ans[i] = 100;//分钟和秒钟居然会是09:9:2的情况..擦.擦..擦.
             if(scoer[i] == 0)ans[i] = 50 ;
             x[scoer[i]]++;
             time[i] = aa*3600+bb*60+cc;
        }
        for(int i = 4 ; i > 0 ; i--)
        {
            int m = 0;
            for(int j = 1 ; j <= n ; j++)
            {
                if(scoer[j] == i)
                {
                    b[m++] = j;
                }
            }
            for(int k = 0 ; k < m ; k++)
            {
                int res = 0;
                for(int l = 0 ; l < m ; l++)
                {
                    if(time[b[k]] < time[b[l]])
                    {
                        res++;
                    }
                }
                if(i == 4)
                {
                     if( res*2 >= x[scoer[b[k]]] )
                     {
                        ans[b[k]] = 95;
                     }
                     else ans[b[k]] = 90;
                }
               if(i == 3)
               {
                  // printf("%lf %lf\n",res,x[scoer[b[k]]]*1.0/2);
                    if( res*2 >= x[scoer[b[k]]])
                     {
                        ans[b[k]] = 85;
                     }
                     else ans[b[k]] = 80;
               }
               if(i == 2)
               {
                  if( res*2 >= x[scoer[b[k]]] )
                     {
                        ans[b[k]] = 75;
                     }
                     else ans[b[k]] = 70;
               }
               if(i == 1)
               {
                   if( res*2 >= x[scoer[b[k]]])
                     {
                        ans[b[k]] = 65;
                     }
                     else ans[b[k]] = 60;
               }
            }


        }
      for(int i = 1 ; i <= n ; i++)
      {
          printf("%d\n",ans[i]);
      }
      printf("\n");
    }
    }
}