zoukankan      html  css  js  c++  java
  • E

    E - What Is Your Grade?

    Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u

    Description

    “Point, point, life of student!” 
    This is a ballad(歌谣)well known in colleges, and you must care about your score in this exam too. How many points can you get? Now, I told you the rules which are used in this course. 
    There are 5 problems in this final exam. And I will give you 100 points if you can solve all 5 problems; of course, it is fairly difficulty for many of you. If you can solve 4 problems, you can also get a high score 95 or 90 (you can get the former(前者) only when your rank is in the first half of all students who solve 4 problems). Analogically(以此类推), you can get 85、80、75、70、65、60. But you will not pass this exam if you solve nothing problem, and I will mark your score with 50. 
    Note, only 1 student will get the score 95 when 3 students have solved 4 problems. 
    I wish you all can pass the exam! 
    Come on! 

    Input

    Input contains multiple test cases. Each test case contains an integer N (1<=N<=100, the number of students) in a line first, and then N lines follow. Each line contains P (0<=P<=5 number of problems that have been solved) and T(consumed time). You can assume that all data are different when 0<p. 
    A test case starting with a negative integer terminates the input and this test case should not to be processed. 

    Output

    Output the scores of N students in N lines for each case, and there is a blank line after each case. 

    Sample Input

    4
    5 06:30:17
    4 07:31:27
    4 08:12:12
    4 05:23:13
    1
    5 06:30:17
    -1

    Sample Output

    100
    90
    90
    95
    
    100

    //题目意思搞了好久才懂,不懂英语真难玩啊。
    有点类似ACM排名
    第一行代表有多少个人,然后是每个人的成绩,做了几个题,用时多少。做了5个,不管用时,都是100,少做1个扣10分,没做不管用时都是50分,做了相同题目的,用时排在一半之前加5分,例如 4个人都做4个,前两个 95分,后两个 90 分, 3个人做 4 个,只有第一个 95 分,后两个90分。

    //可以dp,可以模拟,然后我果断选了模拟。。。
    有几重循环,竟然还是 0ms 有点惊讶

     1 #include <iostream>
     2 #include <stdio.h>
     3 #include <string.h>
     4 #include <algorithm>
     5 using namespace std;
     6 
     7 struct People
     8 {
     9     int num;
    10     int t;
    11     int h,m,s;
    12     int fen;
    13 }people[101];
    14 
    15 int cmp(People a,People b)
    16 {
    17     if (a.t!=b.t)
    18         return a.t>b.t;
    19 
    20     if (a.h!=b.h)   //用时少在前面
    21         return a.h<b.h;
    22     if (a.m!=b.m)
    23         return a.m<b.m;
    24     return a.s<b.s;
    25 }
    26 
    27 int main()
    28 {
    29     int n;
    30     int i,j,k;
    31     while (scanf("%d",&n)!=EOF)
    32     {
    33         if (n<0) break;
    34 
    35         for (i=1;i<=n;i++)
    36         {
    37             scanf("%d %d:%d:%d",&people[i].t,&people[i].h,&people[i].m,&people[i].s);
    38             people[i].num=i;
    39         }
    40         sort(people+1,people+n+1,cmp);
    41 
    42         for (i=1;i<=n;i++)
    43         {
    44             if (people[i].t!=5)
    45                 break;
    46             else
    47                 people[i].fen=100;
    48         }
    49 
    50         int star=i;
    51 
    52         for (i=4;i>=1;i--)//做题数
    53         {
    54             for (j=star;j<=n;j++)   //找到做题数相同的一块  str - (j-1)
    55                 if (people[j].t!=i)
    56                     break;
    57 
    58             int mid=(star+j-1)/2;
    59             if ((star+j-1)%2==0)
    60                 mid--;
    61             
    62             for (k=star;k<j;k++)
    63             {
    64                 if (k<=mid)
    65                 people[k].fen=50+i*10+5;
    66                 else
    67                 people[k].fen=50+i*10;
    68             }
    69             star=j;
    70             if (star>n) break;
    71         }
    72         
    73         for (j=star;j<=n;j++) people[j].fen=50;
    74 
    75         if (n==1&&people[1].t!=5&&people[1].t!=0) people[1].fen+=5;
    76 
    77         for (i=1;i<=n;i++)
    78         {
    79             for (j=1;j<=n;j++)
    80             {
    81                 if (people[j].num==i)
    82                 {
    83                     printf("%d
    ",people[j].fen);
    84                     break;
    85                 }
    86             }
    87         }
    88         printf("
    ");
    89     }
    90     return 0;
    91 }
    View Code

     



  • 相关阅读:
    网线 ------ 交叉线
    ubuntu ------ 网络 ifconfig 不显示IP地址
    STM32L011D4 ----- 低功耗
    List 集合 使用 remove 踩得坑
    Map 集合遍历的4种方法
    elasticsearch 集群详解
    谷歌浏览器添加插件时显示程序包无效:"CRX_HEADER_INVALID" 解决办法
    MySql数据库 优化
    MySql 索引
    Kibana 安装
  • 原文地址:https://www.cnblogs.com/haoabcd2010/p/5753786.html
Copyright © 2011-2022 走看看