“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. [gcd,灵感] Codeforces 1200C Round Corridor

    题目:https://codeforces.com/contest/1200/problem/C C. Round Corridor time limit per test 1 second memo ...

  2. Tensorboard详解(下篇)

    间提壶华小厨 1 Tensorflow监控指标可视化 除了GRAPHS栏目外,tensorboard还有IMAGES.AUDIO.SCALARS.HISTOGRAMS.DISTRIBUTIONS.FR ...

  3. 一文总结数据科学家常用的Python库(下)

    用于建模的Python库 我们已经到达了本文最受期待的部分 - 构建模型!这就是我们大多数人首先进入数据科学领域的原因,不是吗? 让我们通过这三个Python库探索模型构建. Scikit-learn ...

  4. Kubernetes(K8s) 安装(使用kubeadm安装Kubernetes集群)

    背景: 由于工作发生了一些变动,很长时间没有写博客了. 概述: 这篇文章是为了介绍使用kubeadm安装Kubernetes集群(可以用于生产级别).使用了Centos 7系统. 一.Centos7 ...

  5. coding++:Semaphore—RateLimiter-漏桶算法-令牌桶算法

    java中对于生产者消费者模型,或者小米手机营销 1分钟卖多少台手机等都存在限流的思想在里面. 关于限流 目前存在两大类,从线程个数(jdk1.5 Semaphore)和RateLimiter速率(g ...

  6. [vios1023]维多利亚的舞会3<强联通分量tarjan>

    题目链接:https://vijos.org/p/1023 最近在练强联通分量,当然学的是tarjan算法 而这一道题虽然打着难度为3,且是tarjan算法的裸题出没在vijos里面 但其实并不是纯粹 ...

  7. MATLAB 句柄绘图

    一.线句柄实例 >> h1=line([0:10],[0:10])%创建句柄值 h1 = Line (具有属性): Color: [0 0.4470 0.7410] LineStyle: ...

  8. java单元/集成测试中使用Testcontainers

    1.Testcontainers介绍: Testcontainers是一个Java库,它支持JUnit测试,提供公共数据库.SeleniumWeb浏览器或任何可以在Docker容器中运行的轻量级.一次 ...

  9. Codeforces 631 (Div. 2) C. Dreamoon Likes Coloring 思维or构造

    https://codeforces.com/contest/1330/problem/C 给n个格子染色,有m种颜色,要求最后的所以格子被染色,并且有m种颜色. 染色要求:每种颜色有一个值li,选择 ...

  10. 如何让Java应用成为杀不死的小强?(下篇)

    各位坐稳扶好,我们要开车了.不过在开车之前,我们还是例行回顾一下上期分享的要点. 经过前两期的铺垫及烧脑的分享,我们大概对「如何实现 Java 应用进程的状态监控,如果被监控的进程 down 掉,是否 ...