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
95100

题意:本题就是让你根据学生完成作业的数目以及所花费的时间给学生打分,当完成5个题目是就是100分,四个题就是90分(这里面如果有学生排名在前百分之五十的话就是95分),以此类推,让你输出每一个学生的分数

分析:本题涉及到排序问题,如果将所有时间化为同一个单位再进行排序的话就感觉比较麻烦,于是我在百度上找到了专门对字符串进行排序的函数,直接用结构体排序排序就会简单很多

心得:又学到一个新知识点,感觉还是比较好理解的

知识点:结构体排序
#include <iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
struct node
{int x;char s[10];
}a[101];
int main()
{int n;while(scanf("%d",&n),n!=-1){for(int i=0;i<n;i++)scanf("%d %s",&a[i].x,a[i].s);int t[5]={0};for(int i=4;i>0;i--)//做出相同题数的人的个数 {for(int j=0;j<n;j++){if(a[j].x==i) t[i]++;}}for(int i=0;i<n;i++){if(a[i].x==5) printf("100\n");else if (a[i].x==0) printf("50\n");else{int k=0;for(int j=0;j<n;j++){if(a[j].x==a[i].x&&strcmp(a[j].s,a[i].s)<0)
//头文件是string,实质就是a[j].s<a[i].sk++;}if(k>=t[a[i].x]/2)
//相同题数用时短的人数> 做出相同题数的总人数一半 printf("%d\n",100-(5-a[i].x)*10);else printf("%d\n",100-(5-a[i].x)*10+5);}}printf("\n");}return 0;
}

  

转载于:https://www.cnblogs.com/lbyj/p/5761100.html

E - What Is Your Grade?相关推荐

  1. 【HDU】1084 What Is Your Grade? (结构体 sort)

    http://acm.hdu.edu.cn/showproblem.php?pid=1084 题目的关键: 1.Note, only 1 student will get the score 95 w ...

  2. BZOJ 1592. Making the Grade(思维,数据结构优化DP,以及三个拓展问题)[Usaco2008 Feb]【BZOJ计划】

    整理的算法模板合集: ACM模板 点我看算法全家桶系列!!! 实际上是一个全新的精炼模板整合计划 BZOJ简单题合集x 目录 BZOJ 1592. Making the Grade 拓展问题一 拓展问 ...

  3. GRADE:联合学习演化节点和社区表示的概率生成模型

    作者 | 李梓盟 审稿 | 董靖鑫 今天给大家介绍加拿大蒙特利尔大学的著名学者唐建等人发表的一篇文章.作者在文章中针对现有的图动力学建模方法不能明确地捕捉到时间上的社区动态这一问题,提出了通过在轨迹上 ...

  4. mysql中grade字段降序排列_mysql高级查询

    [聚合函数] 统计记录的条数 select count(*) from 表名; 求某个字段所有值的总和 select sum(字段名) from 表名; 求某个字段所有值的平均值 select avg ...

  5. c语言字符变量grade如何定义,c语言基础概念笔记

    最近看到自己之前刚开始学习的时候记的一些笔记就稍微整理了一下 第一章 c语言注释 概念:给代码进行解释说明 作用:加强程序代码的可读性和维护性 /*:多行注释 //:单行注释 变量和基本数据类型 变量 ...

  6. 洛谷 P2893 [USACO08FEB]修路Making the Grade 解题报告

    P2893 [USACO08FEB]修路Making the Grade 题目描述 A straight dirt road connects two fields on FJ's farm, but ...

  7. phrases practice_七年级短语、固定搭配练习题Phrases practice for Grade seven

    Phrases practice for Grade seven( 英汉汉英互译 ) Be______with: 小心对待 从现在起: _________________ 匆忙: __________ ...

  8. 端计算(2)-android studio 的sdk,avd,grade及其它缓存配置

    1.sdk 2.avd 3.grade

  9. 投资级别(Investment Grade)

    投资级别(Investment Grade) Definition of 'Investment Grade' A rating that indicates that a municipal or ...

  10. (转)FPGA的速度等级(speed grade)

    2008-06-06 17:04 XILINX公司FPGASpartan 3E系列XC3S500E速度等级为4.但一直不知道是什么意思. 通过学习知道, (1)CPLD与FPGA的速度等级定义的区别 ...

最新文章

  1. php示例代码使用mysql_fetch_assoc函数
  2. SQL Server 2012 数据库镜像配置完整篇
  3. 倍福TwinCAT(贝福Beckhoff)常见问题(FAQ)-如何设置PLC的扫描周期,运行周期
  4. C++Primer::头文件设计基本原则 与 预处理器介绍
  5. 双向链表的操作(创建,插入,删除)
  6. 安卓案例:注册用户免启动时的广告页面
  7. java write 去bom_Java处理UTF-8带BOM的文本的读写
  8. Java统计文件行数
  9. PHP与C#的值类型指向区别
  10. Linux 容器 vs 虚拟机 —— 谁更胜一筹
  11. cad编辑节点快捷键是什么_cad2018快捷键大全
  12. 标注工具: Label Studio
  13. 2008 r2安装总是跳出 server sql_Microsoft SQL Server 2008 R2 安装遇到的问题
  14. 第三方支付龙头拉卡拉IPO过会
  15. Sdut PTA练习 2021级-JAVA01 Java入门
  16. Occam‘s razor - 奥卡姆剃刀
  17. Keras loss函数
  18. 阅文集团面试题回答不完善的总结
  19. 练习------复仇者联盟(设置一个立体盒子)
  20. Cause: java.sql.SQLException: 无效的列类型

热门文章

  1. 悲剧!IDEA 突然找不到类了?
  2. linux 下 docker NGINX+PHP+MYSQL+REDIS+Elasticsearch 开发环境搭建
  3. 阶段3 3.SpringMVC·_01.SpringMVC概述及入门案例_06.入门案例的流程总结
  4. Microsoft ASP.NET 4 Step by Step
  5. 20.Mybatis之逆向工程
  6. spring第二冲刺阶段第七天
  7. mysql使用Navicat 导出和导入数据库
  8. Math、Number、String 、Array、Object 的新 APIs
  9. swift 笔记 (二十一) —— 高级运算符
  10. db.serverStatus()