“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. MySQL----DDL(操作数据库,表)

    1. 操作数据库:CRUD 1. C(Create):创建 * 创建数据库: * create database 数据库名称; * 创建数据库,判断不存在,再创建: * create database ...

  2. 洛谷 P2257 YY的GCD 题解

    原题链接 庆祝: 数论紫题 \(T4\) 达成! 莫比乌斯 \(T1\) 达成! yy 真是个 神犇 前记 之前我觉得: 推式子,直接欧拉筛,筛出个 \(\phi\),然后乱推 \(\gcd\) 就行 ...

  3. # Unity 游戏框架搭建 2019 (十六、十七) localPosition 简化与Transform 重置

    在上一篇我们收集了一个 屏幕分辨率检测的一个小工具.今天呢再往下接着探索. 问题 我们今天在接着探索.不管是写 UI 还是写 GamePlay,多多少少都需要操作 Transform. 而在笔者刚接触 ...

  4. Git使用的一些问题:.gitignore规则不生效、git同步代码至github和gitee

    Git忽略规则及.gitignore规则不生效的解决办法 .gitignore 的基本使用 在git中如果想忽略掉某个文件,不让这个文件提交到版本库中,可以使用修改根目录中 .gitignore 文件 ...

  5. [HDU2072]单词数<字符串>

    链接:http://acm.hdu.edu.cn/showproblem.php?pid=2072 Problem Description lily的好朋友xiaoou333最近很空,他想了一件没有什 ...

  6. Sql练习201908210951

    表结构: create table SalePlan ( PlanId ,) primary key, GoodsId int, PlanPrice decimal(,) ); go create t ...

  7. 艾编程coding老师课堂笔记:java设计模式与并发编程笔记

    设计模式概念 1.1 什么是设计模式 设计模式(Design Pattern)是前辈们对代码开发经验的总结,是解决特定问题的一系列套路.它不是语法规定,而是一套用来提高代码可复用性.可维护性.可读性. ...

  8. Linux操作系统及调用接口

    Linux操作系统包含以下各子系统: 系统调用子系统:操作系统的功能调用同一入口: 进程管理子系统:对执行程序进行生命周期和资源管理: 内存管理子系统:对系统的内存进行管理.分配.回收.隔离: 文件子 ...

  9. jmeter配置CSV Data Set Config

    Filename:需要引用文件的路径 File encoding:文件的编码格式,文件有中文时,一般是utf-8和gb2312,填其他编码可能乱码 Variable Names:要引用到请求中的变量名 ...

  10. preg_replace突然感觉好强大啊

    <p><img align="absmiddle" src="https://img.alicdn.com/imgextra/i1/1696415374 ...