HDU 1084 What Is Your Grade

『杭电1084』What Is Your Grade? Problem 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 prob 阅读详情
Problem 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
#include <cstdio>
#include <cstring>
#define N 110
struct student
{
	int solve, score;
	char time[10];
}stu[N];
int sum[6];
int n;
void input()
{
	memset(sum, 0, sizeof(sum));
	for (int i = 1; i <= n; i++)
	{
		scanf("%d%*c%s", &stu[i].solve, stu[i].time);
		sum[stu[i].solve]++;

		if (stu[i].solve == 5) stu[i].score = 100;
		else if (stu[i].solve == 0) stu[i].score = 50;
		else stu[i].score = 0;
	}
	for (int i = 1; i <= 4; i++) sum[i] /= 2;
}
void rank()
{
	for (int i = 1; i <= 4; i++)
	{
		for (int j = 1; j <= sum[i]; j++)
		{
			int mini;
			char mint[20] = "99:99:99";
			for (int k = 1; k <= n; k++)
				if (stu[k].solve == i && !stu[k].score && strcmp(stu[k].time, mint) < 0)
				{
					strcpy(mint, stu[k].time);
					mini = k;
				}
			stu[mini].score = 10 * (i + 5) + 5;
		}
		for (int k = 1; k <= n; k++)
			if (stu[k].solve == i && !stu[k].score) stu[k].score = 10 * (i + 5);
	}
}
void output()
{
	for (int i = 1; i <= n; i++) printf("%d\n", stu[i].score);
	printf("\n");
}
int main()
{
	while (scanf("%d", &n), ~n)
	{
		input();
		rank();
		output();
	}
	return 0;
}

Python内置函数zip()——《Python内置函数手册》Python老吕编著 zip()函数是 Python 中的一个内置函数,用于将多个可迭代对象(如列表、元组、字符串等)中对应的元素打包成一个个元组,然后返回由这些元组组成的迭代器。zip()函数常用于将多个序列并行迭代,或者用于数据对齐。zip()它返回一个迭代器,这意味着你可以逐个获取打包后的元素,而不是一次性将所有元素加载到内存中。如果输入的可迭代对象长度不一致,zip()会以最短的可迭代对象为准,只打包到最短对象的末尾。它可以用来并行迭代多个序列,使得代码更加简洁和高效。在接下来的章节中,我们将详细介绍。 阅读详情

相关推荐

数据标注工具:AiLabel.js实现标注 超详细教程 案例分享

背景:在前端开发过程中难免遇到针对图片的缩放平移;以及在图片上进行矢量数据、文本、标注的展示;如果你有上面的任何需求,恭喜你,找到组织了.... 在此背景下,AILabel.js出生了。 前面文章我们已经介绍过AiLabel.js了; https://blog.youkuaiyun.com/u012967771/article/details/113148527 npm下载地址:https://www.npmjs.com/package/ailabel github地址:https://github.com/d.

前端互助会 9365

hdu 1084做题笔记

题意是:有N个人做5道题,给出做出题的个数和花费的总时间,做出5道题给100分,做出4道题给95或90,类推。如果有>=2个人做出题的数目一样,则取前n/2的人较多的分数,如有3个人做出4道题,则第一得95分,其他得90分。主要用的是sort函数。 AC代码如下: #include #include #include using namespace std; const int N=101;

她山之石,决不自弃 825

SAR型ADC的电荷重分配技术解析

本文深入解析了SAR型ADC的核心技术——电荷重分配。通过类比“猜数字”游戏,阐述了其逐次逼近的工作原理,并重点剖析了电容阵列如何实现高速、低功耗的模数转换。文章还探讨了该技术在速度、能效及集成度方面的优势,并指出了电容匹配精度等实际挑战,为嵌入式与物联网设备中的ADC选型与应用提供了实用指南。

nnn11的博客 907

杭电 1084

What Is Your Grade? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 4680    Accepted Submission(s): 1382 Problem Description “Point, poin

ACM2272902662的专栏 1013

基于wxWidgets框架,使用DialogBlocks建立OpenGL界面

前言 之前公司要求使用wxWidgets做GUI,基于OpenGL图形内核,开发三维可视化工具。目前初步开发工作基本已经完成,剩下都是完善了。这里记录一下最开始的框架搭建过程(当然是简化版啦)。wxWidgets结合OpenGL开发可以实现跨平台应用,再结合CMake和VS Code,整体开发工具用习惯了会感觉非常顺手。 界面编辑 首先,使用DialogBlocks新建一个工程,这里工程目录...

cyberobot的博客 2750

【Clickhouse】Cannot allocate block number in Zookeeper write prefix view location

我有一个问题,我CK集群跑批的时候,replicated表变成只读的了下面是CK的报错和当时ZK的日志。下面是zk报错开始 我认为是写入的时候,压力太大,ZK扛不住了,就按照博客里的建议优化了ZK的参数,现在偶尔还会只读,zk报错都是图里的那种clickhouse的集群是5分片的集群,数据量比较大。每小时批量一次,每次2-10W条数据,字段的话,不到200个字段,使用的 jdbc sink写入。

九师兄 836

杭电1084

我的算法已经解决如下问题: (1)数据全部都不相同 (2)包含相同解题数目与解题时间的数据 可是还是Wrong Answer,欢迎大家提供解题方案 #include&lt;stdio.h&gt; #include&lt;string.h&gt; struct pro { int pro; char s[20]; int grade; // int index; }; int main() { in...

weixin_43771250的博客 220

图像做旧算法原理及代码解释

该图像做旧算法主要通过一系列的图像处理操作来模拟旧照片的效果。整体流程包括:首先对输入图像进行颜色调整,降低饱和度并增加黄色调以营造出旧照片的色彩风格;接着添加高斯噪声来模拟旧照片可能存在的颗粒感;最后通过在图像上随机绘制线条来模拟旧照片的划痕和瑕疵。综上所述,该图像做旧算法通过对颜色的调整(包括饱和度降低、色相偏移)、添加高斯噪声以及模拟划痕和瑕疵等一系列操作,从多个方面模拟了旧照片的特征。

m0_44975814的博客 901

【杭电】[1084]What Is Your Grade?

不使用sort排序的话 就可以统计超过自己的个数 与总个数的一半比较

BoilTask Talk Show 564

YOLOv13改进:原创自研 | 卷积魔改 | 一种新颖的风车形卷积(PConv)融合注意力机制,加强微弱小目标检测能力

风车形卷积(PConv)融合注意力机制进一步提升小目标检测能力

①答疑群聊服务;②YOLO大模型知识问答系统;③计算机视觉论文生成智能体; 1056

【vsomeip3 教程】基于 vSomeIP 3.5 的路由域实践:从配置到运行状态的完整指南

___ > 前言(读者定位与准备) 目标读者:在 Linux 上做分布式/车载中间件通信的 C++ 工程师。 > 先决条件:CMake、Boost 基础;理解 TCP/UDP 与多进程通信。 > 文中术语:Routing Host(路由进程)、Application、Service/Instance、Method、Event/EventGroup、SOME/IP-SD。 > 演示环境:单机多进程 & 跨主机两套对照。

探索C++编程的奥秘,分享深入的技术见解和实践,旨在激发读者创造力与解决问题的思维。 1160

What Is Your Grade? HDU - 1084

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1084 解题思路:直接暴力也可以,不过暴力也是可以讲技巧的。因为原题按输入的顺序输出,所以先将需要读入的数据存两份。然后对其中一个按照题目所给规则排序。然后根据邻接表的思想将解题数5 4 3 2 1 0 的人分开存放。最后遍历没有排序的数组,到存放对应的解题数的vector中查找所在位置,判断得分。 ...

成龙大侠的博客 338

【A_Star三维路径规划】基于matlab A_Star算法结合B样条平滑三维地形路径规划(含雷达威胁)【含Matlab源码 3527期】

A_Star算法结合B样条平滑三维地形路径规划(含雷达威胁) 完整代码,包运行;可提供运行操作视频!适合小白!

订阅付费专栏Matlab(奶茶价版),可赠送奶茶价版付费专栏指定代码1份; 741

HDU 1084 What Is Your Grade?

题目网站:http://acm.hdu.edu.cn/showproblem.php?pid=1084    很多人说这是一道水题,但是我却步步维艰,这却是一道水题,却耗了我一天,如果你也被这道题所困扰,希望我的失败能给你提供一些帮助,首先理解一下题目的大义 :        老师要通过五道题给大家评分,做对5道题的,无论时间有多少,都可以得100分,而答对0道题的,无论时间多长都是50分

gusongji的专栏 484

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

蓝牙模块HM-10手册

蓝牙模块HM-10手册,该手册对蓝牙模块HM-10进行了详细的介绍和使用方法以及一些AT指令。

hdu 1084 What Is Your Grade?

http://acm.hdu.edu.cn/showproblem.php?pid=1084 What Is Your Grade? Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9580Accepted Submi...

deyou1988的专栏 132

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

hdu 1084 What Is Your Grade?

What Is Your Grade?                                                                            Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)                  

逸疏 989

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

HDU1084--What Is Your Grade?

HDU1084 What Is Your Grade?

liuyun的专栏 1705

hdu1084(What Is Your Grade?)

<br />http://acm.hdu.edu.cn/showproblem.php?pid=1084<br /> <br />我的代码(ac):<br /> <br />#include<stdio.h><br />#include<stdlib.h><br />#include<memory.h><br />#include<string.h><br />typedef struct Node<br />{<br /> int tag;<br /> int num;<br /> char t[10];

EnjoyInwind的专栏 1062

hdu 1084 What Is Your Grade?

将解决题目数相同的进行排序,求前半部分的最高时间 #include #include struct st { int s,t; }p[1001]; int cmp(const void *a,const void *b) { return *(int *)a-*(int *)b; } int main() { int i,n,a,b,c,d,s[6][10

菜鸟起航的专栏 589

hdu1084 What Is Your Grade? 结构体的应用

隔了有两个星期突然想起来,没有ac掉。

shengweisong 995

HDU1084 What Is Your Grade?

题目链接:HDU1084 What Is Your Grade? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 10371    Accepted Submission(s): 3182 Problem De

teddywang 466

HDU-1084 What Is Your Grade?

HDU-1084 What Is Your Grade? AC代码及题解

包络面的博客 254

(HDU 1084)What Is Your Grade

What Is Your Grade “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 ru...

Istil 416

【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 when 3 students have solved 4 problems. If you can solve 4 problems, you can also get a high score...

( :3 ) 298
上一篇: HDU 1031 Design T-Shirt
下一篇: HDU 1106 排序
达达Mr_X
博客等级 码龄11年 36粉丝 41原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值