CDZSC_2015寒假新人(1)——基础 i

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
 1 #include<iostream>
 2 #include<cstring>
 3 #include<cstdio>
 4 #include<algorithm>
 5 using namespace std;
 6 
 7 int main()
 8 {
 9     int n;
10     struct 
11     {
12             char t[10];//time
13             int p;//problem
14             int s;//score
15     }a[120];
16     while((scanf("%d",&n))&&n!=-1)
17     {
18         for(int i=0;i<n;i++)
19         {
20             scanf("%d%s",&a[i].p,&a[i].t);
21             a[i].s=50+10*a[i].p;
22         }
23         int x=1;
24         while(x<5)
25         {
26             char time[120][10]={"99:99:99"};
27             int num=0;
28             
29             for(int i=0;i<n;i++)
30             {
31                 if(a[i].p==x)
32                 {
33                     strcpy(time[num++],a[i].t);
34                 }
35             }
36             for(int i=0;i<num/2;i++)
37             {
38                 for(int j=i+1;j<num;j++)
39                 {
40                     if(strcmp(time[i],time[j])>0)
41                     {
42                         char p[10];
43                         strcpy(p,time[i]);
44                         strcpy(time[i],time[j]);
45                         strcpy(time[j],p);
46                     }
47                 }
48             }
49             for(int i=0;i<n;i++)
50             {
51                 if(a[i].p==x&&strcmp(a[i].t,time[num/2-1])<=0)
52                 {
53                     a[i].s+=5;
54                 }
55             }
56             x++;
57         }
58         for(int i=0;i<n;i++)
59         {
60             printf("%d\n",a[i].s);
61         }
62         printf("\n");
63     }
64 }
View Code

 

转载于:https://www.cnblogs.com/guofeng1022/p/4241228.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/400943.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

MySql触发器使用

&#x1f680; 优质资源分享 &#x1f680; 学习路线指引&#xff08;点击解锁&#xff09;知识定位人群定位&#x1f9e1; Python实战微信订餐小程序 &#x1f9e1;进阶级本课程是python flask微信小程序的完美结合&#xff0c;从项目搭建到腾讯云部署上线&#xff0c;打造一…

用js添加网页标题时,在QQ里无效,标题栏空白

网页中的标题是从后台数据获取的,用document.title"我的标题",在微信里正常显示标题,但在扣扣里标题栏是空白的,在网上查到一段代码,粘贴上就好了。。。代码如下&#xff1a; var $body $(body);document.title “我的标题”;//兼容 在QQ中设置标题无效,标题不显示…

快速学习23种设计模式思想Design Patterns

1、factory&#xff08;工厂&#xff09;追MM少不了请吃饭了&#xff0c;麦当劳的鸡翅和肯德基的鸡翅都是MM爱吃的东西&#xff0c;虽然口味有所不同&#xff0c;但不管你带MM去麦当劳或肯德 基&#xff0c;只管向服务员说“来四个鸡翅”就行了。麦当劳和肯德基就是生产鸡翅的F…

前端优化实例

页面&#xff1a;m.babytree.com/ask建议&#xff1a;1.降低网络负荷1.1缩小图片尺寸&#xff1a;100-1.png:由252*100 缩小到 127*50100-2.png:由272*100 缩小到 127*50Pregnancy.png: 由144*144 缩小到 72*721.2压缩以下资源图片名称&#xff1a;icon-mak.jpg,icon-weixin.jp…

Go微服务框架go-kratos实战04:kratos中服务注册和服务发现的使用

&#x1f680; 优质资源分享 &#x1f680; 学习路线指引&#xff08;点击解锁&#xff09;知识定位人群定位&#x1f9e1; Python实战微信订餐小程序 &#x1f9e1;进阶级本课程是python flask微信小程序的完美结合&#xff0c;从项目搭建到腾讯云部署上线&#xff0c;打造一…

关于mysql

MariaDB[4] 的API和协议兼容MySQL&#xff0c;另外又添加了一些功能&#xff0c;以支持本地的非阻塞操作和进度报告。这意味着&#xff0c;所有使用MySQL的连接器、库和应用程序也将会在MariaDB下工作。在此基础上&#xff0c;由于担心甲骨文MySQL的一个更加封闭的软件项目&am…

正则表达式验证

/判断输入内容是否为空 function IsNull(){ var str document.getElementById(str).value.trim(); if(str.length0){ alert(对不起&#xff0c;文本框不能为空或者为空格!);//请将“文本框”改成你需要验证的属性名称! } } //判断…

我注册了某音帐号之后。。。(内涵推荐算法)

&#x1f680; 优质资源分享 &#x1f680; 学习路线指引&#xff08;点击解锁&#xff09;知识定位人群定位&#x1f9e1; Python实战微信订餐小程序 &#x1f9e1;进阶级本课程是python flask微信小程序的完美结合&#xff0c;从项目搭建到腾讯云部署上线&#xff0c;打造一…

【转】ORACLE中的子查询 ---OCP--047--46

“子查询”就是查询中嵌套着另一个查询&#xff0c;也即通过SELECT语句的嵌套使用形成子查询。当我们不知道特定的查询条件时,可以用子查询来为父查询提供查询条件以获得查询结果。ORACLE中常见的子查询有下面几类&#xff1a;A、单行子查询(Single-row subqueries)。B、多行子…

第5讲++创建管理数据库

实例 create database db on (namedb51,filenameD:\xxx\db51.mdf,size100,maxsize200,filegrowth20 ), (namedb52,filenameD:\xxx\db52.ndf,size100,maxsize200,filegrowth20 ), (namedb53,filenameD:\xxx\db53.ndf,size100,maxsize200,filegrowth20 ) log on (namedb5log1,fi…

R数据分析:如何简洁高效地展示统计结果

&#x1f680; 优质资源分享 &#x1f680; 学习路线指引&#xff08;点击解锁&#xff09;知识定位人群定位&#x1f9e1; Python实战微信订餐小程序 &#x1f9e1;进阶级本课程是python flask微信小程序的完美结合&#xff0c;从项目搭建到腾讯云部署上线&#xff0c;打造一…

实现权重计算

今天试图实现内部点权重的计算。在论文中&#xff0c;权重的计算过程是这样的:其中solveNNLS是求解这个方程s为表面点&#xff0c;q为内部点发现两种方法&#xff1a;1.一种是把内部点位置表示成表面点的线性组合2.另一种是把内部点的位移表示成表面点的线性组合第2种可以化成内…

Android LBS系列05 位置策略(一)

Location Strategies 定位的实现 在Android系统上实现定位主要是通过GPS或者是基于网络的定位方法。 GPS是精度最高的&#xff0c;但是它只在户外有用&#xff0c;并且很耗电&#xff0c;并且首次定位花费时间较长。 基于网络的定位利用通信网络蜂窝基站和Wi-Fi信号&#xff0c…

使用并查集解决的相关问题

&#x1f680; 优质资源分享 &#x1f680; 学习路线指引&#xff08;点击解锁&#xff09;知识定位人群定位&#x1f9e1; Python实战微信订餐小程序 &#x1f9e1;进阶级本课程是python flask微信小程序的完美结合&#xff0c;从项目搭建到腾讯云部署上线&#xff0c;打造一…

ABP官方文档翻译 3.1 实体

实体 实体类聚合根类 领域事件常规接口 审计软删除激活/失活实体实体改变事件IEntity接口实体是DDD(领域驱动设计)的核心概念之一。Eric Evans描述它为"An object that is not fundamentally defined by its attributes, but rather by a thread of continuity and identi…

目标检测之线段检测---lsd line segment detector

&#xff08;1&#xff09;线段检测应用背景 &#xff08;2&#xff09;线段检测原理简介 &#xff08;3&#xff09;线段检测实例 a line segment detector &#xff08;4&#xff09;hough 变换和 lsd 的区别 ---------------------author&#xff1a;pkf ------------------…

struts:file 提交给action后获取文件信息

参考&#xff1a; 1&#xff09;http://gemini.iteye.com/blog/67712 2&#xff09;http://bbs.csdn.net/topics/320228159 转载于:https://www.cnblogs.com/lpshou/archive/2013/01/15/2861581.html

利用Mac创建一个 IPv6 WIFI 热点

标签&#xff1a; iOSIPv6Create NAT64 NetWork创建NAT64网络2016-05-20 10:58 14156人阅读 评论(11) 收藏 举报分类&#xff1a;开发技巧&#xff08;8&#xff09; 版权声明&#xff1a;本文为博主原创文章&#xff0c;未经博主允许不得转载。 苹果商店6月1日起&#xff0c;强…

SQL2000 MD5加密

原文:SQL2000 MD5加密 /***************************************************************************** * Name: T-SQL MD5算法实现 * Author: Rambo Qian * Create Date: 2003-04-10 * Last Modified by: Rambo Qian * Last Update Date: 2003-04-16 * Version: V1.…

经典电影

那些经典的电影&#xff0c;第一波&#xff01;&#xff01; 《怦然心动》&#xff0c;欧美电影——布莱斯全家搬到小镇&#xff0c;邻家女孩朱丽前来帮忙。她对他一见钟情&#xff0c;心愿是获得他的吻。两人是同班同学&#xff0c;她一直想方设法接近他&#xff0c;但是他避之…