“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! 

InputInput 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. 
OutputOutput 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

刚看到这个题目的时候有点懵,但是尝试着写了一下。。。。思路简单的很

#include<iostream>
#include<algorithm>
#include<string>
#include<cstdio>
#include<math.h>
using namespace std;
struct stu
{
int a;
string b;
int c;//记录当前的分数
};
//先用sort对副本数组num2排序,a优先,b其次,c不用管 ,最后在转换为num1
bool cmp(stu x,stu y)
{
if(x.a!=y.a)
return x.a>y.a;
return x.b<y.b;//时间取较小的
}
int main()
{
int n;
while(cin>>n)
{
int s[]={};//,一定要定义在循环内部,,,错了好几次
struct stu num1[],num2[];
if(n<)
break; for(int i=;i<n;i++)
{
cin>>num1[i].a>>num1[i].b;
num2[i].a=num1[i].a;
num2[i].b=num1[i].b;
s[num1[i].a]++;//记录每个值出现的次数
} sort(num2,num2+n,cmp);
int x=,y=,z=,w=;
for(int i=;i<n;i++)
{
if(num2[i].a==)
{
num2[i].c=;
} else if(num2[i].a==)
{
x++;//记录4出现的次数
if(s[]==)
num2[i].c=;
else
{
if(s[]/>=x)//如果4出现的次数比中值小 则赋值为95,否则 90
{
num2[i].c=;
}
else
{
num2[i].c=;
}
}
}
else if(num2[i].a==)
{
y++;
if(s[]==)
num2[i].c=;
else
{
if(s[]/>=y)
{
num2[i].c=;
}
else
{
num2[i].c=;
}
}
}
else if(num2[i].a==)
{
z++;
if(s[]==)
num2[i].c=;
else
{
if(s[]/>=z)
{
num2[i].c=;
}
else
{
num2[i].c=;
}
}
} else if(num2[i].a==)
{
w++;
if(s[]==)
num2[i].c=;
else
{
if(s[]/>=w)
{
num2[i].c=;
}
else
{
num2[i].c=;
}
}
}
else if(num2[i].a==)
{
num2[i].c=;
}
}
//转换 根据num2 对num1 中的c赋值
for(int i=;i<n;i++)
{
for(int j=;j<n;j++)
{
if(num1[i].a==num2[j].a && num1[i].b==num2[j].b)
{
num1[i].c=num2[j].c;
break;
}
}
}
for(int i=;i<n;i++)
cout<<num1[i].c<<endl;
cout<<endl;
}
return ;
}
//自己造的数据
/*
15
5 06:30:17
4 07:31:27
4 08:12:12
4 05:23:13
4 06:30:17
3 05:23:13
3 05:23:12
3 05:23:11
3 05:23:10
3 05:23:09
2 06:30:17
2 06:30:12
1 05:23:01
0 08:12:12
*/

F - What Is Your Grade?的更多相关文章

  1. 动手动脑之小程序:TryAndCatch

    源代码 import java.util.InputMismatchException;import java.util.Scanner;public class TryAndCatch {publi ...

  2. java基础-控制流语句

    浏览以下内容前,请点击并阅读 声明 一般情况下,代码的执行按照从上到下的顺序,然而通过加入一些判断,循环和跳转语句,你可以有条件地执行特定的语句. 接下来分三部分介绍Java的控制流语句,他们是判断语 ...

  3. HDU POJ 1015 Jury Compromise(陪审团的人选,DP)

    题意: 在遥远的国家佛罗布尼亚,嫌犯是否有罪,须由陪审团决定.陪审团是由法官从公众中挑选的.先随机挑选n个人作为陪审团的候选人,然后再从这n个人中选m人组成陪审团.选m人的办法是:控方和辩方会根据对候 ...

  4. 10分钟学会ES7+ES8

    撰文为何 身为一个前端开发者,ECMAScript(以下简称ES)早已广泛应用在我们的工作当中.了解ECMA机构流程的人应该知道,标准委员会会在每年的6月份正式发布一次规范的修订,而这次的发布也将作为 ...

  5. C++课程设计2

    PS:大一下学期C++课程设计 1.成绩管理系统 #include<stdio.h> #include<string> #include<iostream> #in ...

  6. Python的控制语句

    1.  控制语句 控制语句是用来改变程序执行的顺序.程序利用控制语句有条件地执行语句,循环地执行语句或者跳转到程序中的其他部分执行语句. Python支持三种不同的控制语句:if,for和while, ...

  7. [shell] if语句用法

    bash中如何实现条件判断?条件测试类型:    整数测试    字符测试    文件测试 一.条件测试的表达式:    [ expression ]  括号两端必须要有空格    [[ expres ...

  8. if 语句中的判断

    经常写shell的朋友可能已经很熟了.有不同意见的同学请指出来,在这里多谢大家了. bash中如何实现条件判断?条件测试类型:    整数测试    字符测试    文件测试 一.条件测试的表达式: ...

  9. es7,es8

    ES7新特性 ES7在ES6的基础上添加了三项内容:求幂运算符(**).Array.prototype.includes()方法.函数作用域中严格模式的变更. Array.prototype.incl ...

随机推荐

  1. [Redis] 万字长文带你总结Redis,助你面试升级打怪

    文章目录 Redis的介绍.优缺点.使用场景 Linux中的安装 常用命令 Redis各个数据类型及其使用场景 Redis字符串(String) Redis哈希(Hash) Redis列表(List) ...

  2. VMware workstation 下Hadoop伪分布式模式安装

    详细过程: 1.VMware安装: 2.centos 6 安装 3.jdk下载安装配置 4.Hadoop 安装配置 1.VMware Workstation 安装: https://www.vmwar ...

  3. 机器学习算法系列:FM分解机

    在线性回归中,是假设每个特征之间独立的,也即是线性回归模型是无法捕获特征之间的关系.为了捕捉特征之间的关系,便有了FM分解机的出现了.FM分解机是在线性回归的基础上加上了交叉特征,通过学习交叉特征的权 ...

  4. adb的基本安装和介绍(一)

    一,什么是adb? adb全称为Android Debug Bridge,就是起到调试桥的作用.顾名思义,adb就是android sdk 的一个工具 借助adb工具,我们可以管理设备或手机模拟器的状 ...

  5. 干净直接安装+PS下载

    PS CS6 https://www.cr173.com/soft/247727.html 直接一键安装,很方便干净. 不要去华军软件下,广告浪费时间. 链接:https://pan.baidu.co ...

  6. 超图iserver登录密码忘记,重置密码

    如果大家在用超图iserver发布服务的过程中将登录密码忘记,大家不要慌,iserver自带的有密码重置功能. 1.首先在登录过程中提示密码错误,具体内容如下图所示: 2.首先先停止iserver服务 ...

  7. 面试刷题30:SpringBean的生命周期?

    spring是Java软件开发的事实标准. 我是李福春,我在准备面试,今天的问题是:springBean的生命周期是怎样的? 答:spring最基础的能力是IOC(依赖注入),AOP(面向切面编程), ...

  8. spring @EnableAspectJAutoProxy背后的那些事(spring AOP源码赏析)

    在这个注解比较流行的年代里,当我们想要使用spring 的某些功能时只需要加上一行代码就可以了,比如: @EnableAspectJAutoProxy开启AOP, @EnableTransaction ...

  9. Ubuntu系统查看命令命令使用方式

    如:[gzip]命令,可执行: (tf) duanyongchun@hc1217:~/pycharm_projects /3DUNet-Pytorch /data$ gzip --help 输出: 由 ...

  10. Linux yum 源配置

    CentOS 7 使用 163 的 yum 源,配置步骤如下: 下载镜像源文件 http://mirrors.163.com/.help/centos.html 备份原配置文件,将下载的文件的名字改成 ...