hdu 1157 (1.3.7) Who's in the Middle

Acrobat Pro DC 2025安装全指南:从环境准备到故障排查 PDF作为跨平台文档交换的标准格式,在日常办公中无处不在,但仅依赖浏览器阅读器难以满足编辑、OCR识别、格式转换等深度需求。专业级PDF编辑器通过底层解析引擎与排版还原技术,实现文本修改、扫描件文字提取、多文件合并等高效操作,在合同管理、财务报销、学术文献整理等场景中不可或缺。Acrobat Pro DC作为行业标杆,功能完整性强,但其安装流程常因旧版残留、系统权限、组件缺失等问题而失败。本文从环境配置、版本选型、卸载清理出发,逐步演示完整安装流程,解析账号激活与默认设置优化,并针对“卡进度条”“无法写入数 阅读详情
<div class="panel_title" align="left">Problem Description</div><div class="panel_content">FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as much or more than the median; half give as much or less. 

Given an odd number of cows N (1 <= N < 10,000) and their milk output (1..1,000,000), find the median amount of milk given such that at least half the cows give the same amount of milk or more and at least half give the same or less.
</div><div class="panel_bottom"> </div>
<div class="panel_title" align="left">Input</div><div class="panel_content">* Line 1: A single integer N 

* Lines 2..N+1: Each line contains a single integer that is the milk output of one cow.
</div><div class="panel_bottom"> </div>
<div class="panel_title" align="left">Output</div><div class="panel_content">* Line 1: A single integer that is the median milk output.
</div><div class="panel_bottom"> </div>
<div class="panel_title" align="left">Sample Input</div><div class="panel_content"><pre><div style="FONT-FAMILY: Courier New,Courier,monospace">5
2
4
1
3
5</div>
 

Sample Output
3
题目实际上是排序,但是用c的输入输出貌似就过不去啊,cin和cout才可以
Hint
INPUT DETAILS: Five cows with milk outputs of 1..5 OUTPUT DETAILS: 1 and 2 are below 3; 4 and 5 are above 3.


// 解法1:使用qsort快排 
//#include <iostream>
//#include <stdlib.h>
//using namespace std;
//int cmp(const void *a, const void *b)
//{
//	return (*(int*)a - *(int*)b);
//}
//
//int main(void)
//{
//	int n, i;
//    int number[100000] = {0};	
//	while(cin >> n)
//	{
//		for(i = 0; i < n; i++)
//			cin >> number[i];
//		qsort(number, n, sizeof(int), cmp);
//		cout << number[(n-1)/2] << endl;
//	}
//	
//	return 0;
//}
// 解法2:使用sort排序 
#include <iostream>
#include <algorithm>
using namespace std;
bool cmp(int a, int b)
{
	return a > b;
}
int main(void)
{
	int n, i;
	int num[10000];
	while(cin >> n)
	{
		for(i = 0; i < n; i++)
			cin >> num[i];
		sort(num, num + n, cmp);
		cout << num[(n-1)/2] << endl; 
	}
	
	return 0;
}

论文解读——YOLOv11(目标检测) YOLOv11提供了多种型号和功能,以满足不同应用场景的需求。对象检测对象检测是YOLOv11的基本功能之一。在训练时,YOLOv11能够检测图像中的对象,并输出对象的边界框和类别信息。这一功能在自动驾驶、智能安防等领域具有广泛应用。图像分割图像分割是YOLOv11的另一个重要功能。与对象检测不同,图像分割不仅检测对象的边界框,还能够对图像中的对象进行像素级别的分割。这使得YOLOv11在医疗影像分析、工业制造等领域具有更高的应用价值。姿态检测姿态检测是YOLOv11的一个独特功能。 阅读详情

相关推荐

华三模拟器实战:IPSec VPN穿越NAT的完整配置与调试(附常见问题排查)

本文详细解析了华三模拟器中IPSec VPN穿越NAT的完整配置与调试方法,包括基础环境准备、分步配置、ACL协调策略及高级故障排查。通过实战案例和关键参数解析,帮助网络工程师解决IPSec与NAT协同工作的典型问题,提升企业网络安全性。

weixin_33724046的博客 463

HDU1157 Who's in the Middle

Who's in the Middle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 9411    Accepted Submission(s): 4538 Problem Description FJ is

长风的专栏 1013

TCN实战:用Python手把手搭建时序预测模型(附完整代码)

本文详细介绍了如何使用Python搭建TCN(Temporal Convolutional Network)时序预测模型,包括数据预处理、模型架构实现、训练调优及预测评估。通过完整的代码示例和实用技巧,帮助开发者快速掌握TCN在时间序列预测中的应用,特别适合处理长期依赖问题。

weixin_29041195的博客 373

HDU 1157 Who's in the Middle 排序

Who's in the Middle                                                                        Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)

Houheshuai的专栏 678

JasperReport制作行内容合并的表格

效果图: 实现思路一: 交叉表 另一个思路: 普通表格 缺点:无法实现内容 垂直居中显示 准备工作 一、数据准备 DROP TABLE IF EXISTS `address_item_sex_value`; CREATE TABLE `address_item_sex_value` ( `id` int(11) NOT NULL AUTO_INCREM...

weixin_34148456的博客 2468

实战案例—encrypt靶场(AES固定key篇)

AES是一种对称密钥加密方法,意味着加密和解密时使用相同的密钥。AES加密存在三种形式:AES-128、AES-192和AES-256,它们分别对应于三种不同的密钥长度——128位(即16字节)、192位(即24字节)和256位(即32字节)。通常情况下,密钥的长度越长,提供的安全性就越高,但相应地,加解密过程所需的时间也会增加。默认情况下,采用的是AES-128,其提供的安全性对于大多数应用来说已经足够充分。

zhouzhou_98的博客 499

HDU 1157 Who's in the Middle

链接:http://acm.hdu.edu.cn/showproblem.php?pid=1157 水题。。~~·~洪水

M阳光的专栏 688

Spring AI Alibaba实战训练营-16 NL2SQL (自然语言转 SQL)应用开发指南

本文介绍了一个基于AI的智能BI应用开发项目,主要实现自然语言转SQL(NL2SQL)功能,包含对话模块、MCP模块、向量数据管理模块。项目采用Spring AI Alibaba框架,集成通义千问大模型,支持内存向量库和AnalyticDB向量数据库两种存储方案。重点展示了chat模块的三个控制器实现:AnalyticNl2SqlController用于生产环境,SimpleChatController适用于开发测试,Nl2sqlForGraphController支持基于图的复杂对话流程。系统通过将业务知

program哲学 1590

HDU-1157 Who's in the Middle

See the article on https://dyingdown.github.io/2019/12/15/HDU-1157%20Who’s-in-the-Middle/ Who’s in the Middle Problem Description FJ is surveying his herd to find the most average cow. He wants to kno...

yaoo_o的博客 205

万字长文介绍ARINC 653,以及在综合模块化航空电子设备(IMA)中的作用

ARINC 653 在综合模块化航空电子设备(IMA)的发展进程中扮演着极为关键的角色。从行业应用的实际情况来看,空客 A380 和波音 787 等先进飞机的航电系统套件充分体现了行业对 IMA 的高度重视和积极投入。在 IMA 架构下,核心软件具备强大的能力,能够支持多个航空电子应用程序的同时运行。这些应用程序可以并行开发,并高效地部署在同一个计算平台上,极大地提高了开发效率和系统集成度。ARINC 653 的出现为航空电子行业创造了一个充满活力和竞争力的商业环境。

2959

Python爬虫实战:使用最新技术爬取GitHub Trending项目

本文将详细介绍如何使用Python最新技术栈构建一个高效的GitHub Trending爬虫。我们将使用异步请求库httpx、HTML解析库parsel、数据存储方案以及反反爬技术,完整实现一个能够稳定获取GitHub Trending数据的爬虫系统。文章包含5000余字详细教程,从环境搭建到代码实现,再到数据处理和存储,最后部署运行,提供全方位指导。GitHub Trending页面展示了GitHub上当前最受欢迎的项目,对于开发者了解技术趋势、发现优秀项目非常有价值。

2201_76125261的博客 739

HDU - 1157 Who's in the Middle 【中间数】【排序】

Description FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as much or more than the median; half give as much or...

一定要站在自己热爱的生活里闪闪发光 3万+

Mamba-YOLOv8深度解析:基于状态空间模型的下一代目标检测架构(含完整代码与实战部署)文末含资料链接!

通过本文的完整指南,您将掌握从理论创新到工程落地的全流程技术细节。立即动手实践,开启目标检测的新纪元!

FJN110的博客 522

HDU1157 POJ2388 Who's in the Middle【第k大数+中位数+水题】

Who's in the Middle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 20282    Accepted Submission(s): 8906 Problem Description FJ is sur

海岛Blog 1698

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

快速排序浅谈——(解题报告)HDU1157和POJ2388---Who's in the Middle

快速排序(快排)作为排序算法中较为常用和重要的一种,有其重要的地位,但初学可能有些晦涩,本文将较为详细的结合Who’s in the Middle这道题来讲讲快速排序的奥秘!首先是快排的简单介绍,它是由冒泡排序改进而来,基本思想是:(百科)通过一趟排序将要排序的数据分割成独立的两部分,其中一部分的所有数据都比另外一部分的所有数据都要小,然后再按此方法对这两部分数据分别进行快速排序,整个排序过程可以递

PrConstantin 817

深度学习工具包 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&#39;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(&#39;DeepLearnToolbox&#39;));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(&#39;state&#39;,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&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,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 = &#39;sigm&#39;;%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, &#39;Too big error&#39;);```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(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;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)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;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, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% 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&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 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, &#39;Too big error&#39;);```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(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,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, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % 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, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);%% 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(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % 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, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

HDU1157:Who's in the Middle

Problem Description FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as much or more than the median; half give as

ACM!荣耀之路! 2448

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

hdu1157 Who's in the Middle

Problem Description FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as much or more than the median; half give a

sinat_39591298的博客 378

HDU --1157 Who's in the Middle——nth_element

Description FJ is surveying his herd to find the most average cow. He wants to know how much milk this 'median' cow gives: half of the cows give as much or more than the median; half give as much o

xiaohuihui 679

hdu 1157 Who's in the Middle

http://acm.hdu.edu.cn/showproblem.php?pid=1157 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6012 Accepted Submission(s): 3003 Problem

xiaohunuli的专栏 400

【HDU】1157 Who's in the Middle

问题描述FJ正在调查他的牛群以找到最平均的牛。他想知道这只“中位数”的牛给了多少牛奶:一半的奶牛比中位数多或多; 一半给予或多或少。鉴于N(1 &lt;= N &lt;10,000)奶牛数量奇怪(1 &lt;= N &lt;10,000),找到给奶量的中位数,以便至少有一半奶牛能够提供相同数量的奶或更多至少一半给出相同或更少。 输入*第1行:单个整数N *第2..N + 1行:每行包含一个整数,它...

biongbiongdou的博客 1498

[HDOJ 1157] Who's in the Middle (基础题)

题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1157  5482827 2012-03-06 18:16:49 Accepted 1157 0MS 384K 330 B C++ ajioy #include #include #include using namespace std;

AJIOY的专栏 837
上一篇: hdu 2561 第二小整数
下一篇: linux下用gcc编译使用了math库函数的程序出错的解决方法
Attacker2001
博客等级 码龄12年 101粉丝 37原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值