codeup21751 超过平均身高

用C编译的一个简单的计算计算平均身高的程序 用C编译的一个简单的计算计算平均身高的程序,初学者学习学习 立即下载

codeup21751 超过平均身高

时空限制    1000ms/128MB

题目描述

小东东班里有n口人,每人的身高都量出来了,你能帮他找出身高超出全班平均身高的成员编号和他的高度吗?

输入

第一行:输入0<n=<100(全班的人数)。

第二行:  分别输入每个成员的身高,以空格隔开。

输出

平均身高

编号和身高。

样例输入

7
175 160 172 158 178 162 142

样例输出

163.9
1:175 3:172 5:178

提示

平均身高值保留一位小数。身高值位整数。

第二行输出的是超出平均身高的成员编号和他的高度。

 

代码

#include<iostream>
#include<cstdio>
using namespace std;
int h[105];

int main(){
	int n;
	double ave=0;
	cin>>n;
	for (int i=1; i<=n; i++){
		cin>>h[i];
		ave += h[i];	//累加身高
	}
	ave /= n;	//平均身高
	printf("%.1f\n",ave);
	for (int i=1,first=0; i<=n; i++)
		if (h[i]>ave){
			if (++first>1) cout<<" ";
			cout<<i<<":"<<h[i];
		}
	cout<<endl;
	return 0;
}
C++1155 - 找找谁的身高超过全家的平均身高 找找谁的身高超过全家的平均身高。 全家 n 口人,输入输出数据如下: (平均身高保留一位小数)。 立即下载

相关推荐

Unity 接入HybridCLR的点点滴滴,亲测三平台(PC、Android、WebGL)妥妥的。-问题分享

一入热更深似海啊,没有热更是真恼火啊,干啥啥不方便,动不动就得重新发包;说实在的,也是工作之余研究这个,在原有框架基础上接入这个热更,既要保持原有功能,还要支持热更,实实在在、断断续续搞了这么久,终于是接入并测通了,这一路是坎坎坷坷,下面把走过的弯弯绕绕记录下,希望对后来想接入的小伙伴有帮助吧。

GarFe的博客 1万+

C++每日一练(6):找找谁的身高超过全家的平均身高

第一行为全家的平均身高(保留一位小数);第二行有若干个数,为超过平均身高的人的身高厘米数。找找谁的身高超过全家的平均身高。全家n口人,输入输出数据如下: (平均身高保留一位小数)第一行有一个整数n( 1 < n < 11 )。第二行是n个整数,用空格隔开。

yyj17705217006的博客 3336

扫地机器人:从仿真到决策,一个完整SLAM导航系统的自研之路

本文详细记录了从零开始自研扫地机器人SLAM导航系统的全过程,涵盖ROS-Gazebo仿真系统搭建、地图预处理优化、全覆盖规划算法迭代等关键技术。通过三次算法升级,最终实现92%的清洁效率,并分享DWA调参、状态机设计等实战经验,为开发者提供从仿真到落地的完整解决方案。

weixin_29053695的博客 361

找找谁的身高超过全班平均身高

找找谁的身高超过全班的平均身高 题目描述 小东东班里有n口人,每人的身高都量出来了,你能帮他找出身高超出全班平均身高的成员编号和他的高度吗? 输入 第一行:输入0<n=<100(全班的人数)。 第二行: 分别输入每个成员的身高,以空格隔开。 输出 平均身高 编号和身高。 ##本人第一次写的,不喜欢勿喷 #include <iostream> using namespace std; int main() { int h[102]; int n; cin>&g

m0_51133676的博客 5171

深度学习动画实战:用MotorNerve系统5步实现自然角色交互

本文详细介绍了如何利用腾讯游戏的MotorNerve系统,通过深度学习技术5步实现自然角色动画交互。从环境搭建、基础运动控制到交互过渡和行走转向优化,该系统能显著提升游戏动画制作效率,尤其适合中小团队替代昂贵的动捕方案。重点解析了骨骼动画配置、PFNN控制器使用及Blender工作流集成等核心技术。

book8的博客 699

手把手教你用Chrome DevTools逆向分析抖音a_bogus参数(附完整日志插桩方法)

本文详细介绍了如何使用Chrome DevTools逆向分析抖音a_bogus参数的生成逻辑,包括XHR断点定位、日志插桩追踪和加密核心逻辑解析。通过实战案例,帮助开发者掌握逆向工程技巧,应对抖音接口的动态加密变化,特别适合研究dy接口和a_bogus参数的技术人员。

weixin_27741699的博客 807

C++数组题目

【代码】C++数组题目。

Yigeputongren的博客 1173

Reeds-Shepp曲线公式推导及代码实现-第二部分(共三部分)

文章目录2. Reeds-Shepp求解2.1 L+S+L+L^+S^+L^+L+S+L+2.2 L+S+R+L^+S^+R^+L+S+R+2.3 L+R−L+L^+R^-L^+L+R−L+2.4 L+R−L−L^+R^-L^-L+R−L−2.5 L+R+L−L^+R^+L^-L+R+L−2.6 L+Rβ+Lβ−R−L^+R_{\beta}^+L_{\beta}^-R^-L+Rβ+​Lβ−​R−2.7 L+Rβ−Lβ−R+L^+R_{\beta}^-L_{\beta}^-R^+L+Rβ−​Lβ−​R+2.8

jianmo的博客 1226

【入门】找找谁的身高超过全家的平均身高

时间限制 : 1 秒内存限制 : 128 MB找找谁的身高超过全家的平均身高。全家 n 口人,输入输出数据如下: (平均身高保留一位小数)。

LYK_0910的博客 949

Cadence PCB SI仿真实战:如何手动添加VIA过孔模型提升板级链路精度

本文详细介绍了在Cadence PCB SI仿真中如何手动添加VIA过孔模型以提升DDR4/5设计的精度。通过参数化建模和三维全波建模技术,工程师可以有效解决高速设计中的信号完整性问题,显著降低仿真误差。文章还提供了实战案例和常见问题解决方案,帮助优化板级链路性能。

weixin_28683391的博客 420

【Oracle】Oracle rman工具使用(真的细)

Oracle RMAN(Recovery Manager)是Oracle数据库备份和恢复的官方工具,它提供的备份和恢复功能非常强大和可靠。RMAN可以备份整个数据库或特定表空间、数据文件、控制文件和归档日志,同时还可以进行增量备份和增量恢复。RMAN还提供了诸如备份验证、备份优化、备份复制、备份集管理、恢复操作、自动备份、自动恢复等高级功能。它使用的备份和恢复格式是Oracle通用的备份集(Backup Set),这使得备份和恢复非常灵活和高效。

tttzzzqqq2018的博客 8520

目录------数组

01 ybt1105_数组逆序 02 codeup21751_超过平均身高 03 luogu1046_陶陶摘苹果(NOIP2005普及组第1题) 04 luogu1047_校门外的树(NOIP2005普及组第2题) 05 luogu1276_校门外的树(增强版) 06 luogu1089_津津的存储计划(NOIP2004提高组第1题) 07...

HCSDN 622

基于MATLAB的特征模式分解(FMD)算法详解

本文详细介绍了基于MATLAB的特征模式分解(FMD)算法实现。FMD是一种新型自适应信号分解方法,通过自适应FIR滤波器组和相关峭度优化目标,有效解决传统方法(如EMD、VMD)的模态混叠问题。文章系统阐述了FMD的算法原理、数学模型和实现步骤,包括自适应FIR滤波器设计、相关峭度优化和模态选择机制。与现有方法相比,FMD在旋转机械故障诊断中展现出更强的特征提取能力和噪声鲁棒性。MATLAB实现部分包含核心函数、参数优化和可视化工具,并通过轴承故障等案例验证了算法的有效性。

qq_42212808的博客 199

c++找找谁的身高超过全家的平均身高

题目描述找找谁的身高超过全家的平均身高。全家 n 口人,输入输出数据如下: (平均身高保留一位小数)。输入第一行有一个整数 n ( 1

m0_72914941的博客 890

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

【重庆市渝北八中初2025级】数组专项训练-2

【重庆市渝北八中初2025级】数组专项训练-2(上)

ouyangyelei的博客 1147

Data-Structures-and-Algorithm-Analysis-in-Java.pdf

作者: Weiss, Mark A. 出版社: Addison Wesley Data Structures and Algorithm Analysis in Java is an “advanced algorithms” book that fits between traditional CS2 and Algorithms Analysis courses. In the old ACM Curriculum Guidelines, this course was known as CS7. This text is for readers who want to learn good programming and algorithm analysis skills simultaneously so that they can develop such programs with the maximum amo...

Jzoj 一维数组(包括排序)部分代码(共42题)

Jzoj 数组部分题目 1117: 【入门】数组逆序 2787: 【入门】统计 1635: 【入门】输出奇数和偶数 1113: 【入门】最大数 1125: 【入门】找找谁的身高超过全家的平均身高 1118: 【入门】数组元素的查找 1135: 【入门】查找支撑数 1120: 【入门】数组元素的移动 1121: 【入门】数组元素的插入 1122: 【入门】数组元素的删除 1119: 【入门】元素插入有序数组 1138: ......

ypeijasd的专栏 6705

深度学习工具包 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")

3165: 找找谁的身高超过全家的平均身高

printf 的强类型要求: printf 不会进行类型检查,因此使用不正确的格式说明符可能会导致未定义行为。安全性问题: printf 是不安全的,尤其是在处理用户输入的字符串时,可能会导致格式化字符串漏洞。在 C++ 中,printf 是一个非常常用的函数,用于格式化输出。它源自 C 语言的标准库,但在 C++ 中仍然可以使用,尤其是在需要与 C 代码兼容或更高效的输出时。printf(“宽度为5的整数: [%5d]\n”, num);printf(“宽度为3的整数: [%3d]\n”, num);

smallnengneng的博客 334

东方博宜 1155. 找找谁的身高超过全家的平均身高

东方博宜 1155. 找找谁的身高超过全家的平均身高 信奥赛 c++

weixin_43423646的博客 617

【题解】【PTA-Python题库】第3章-1 3-1.大于身高的平均值 (10 分)

3-1.大于身高的平均值 (10 分) 中小学生每个学期都要体检,要量身高,因为身高可以反映孩子的生长状况。现在,一个班的身高已经量好了,请输出其中超过平均身高的那些身高。程序的输入为一行数据,其中以空格分隔,每个数据都是一个正整数。程序要输出那些超过输入的正整数的平均数的输入值,每个数后面有一个空格,输出的顺序和输入的相同。 输入格式: 在一行输入中一个班的身高值,以空格分隔。 输出格式: 在一...

葑鈊丶 2万+

信息学奥赛C++语言:高个子的人数

【题目描述】 给定n个同学的身高(均为100-200之间的整数),求超过平均身高的同学人数。 【输入】 第一行包含一个整数n,n<=10000。 第二行包含n个正整数,之间用一个空格隔开。 【输出】 一行一个整数,表示超过平均身高的同学人数。 【输入样例】 6 160 155 170 175 172 164 【输出样例】 3 代码 ...

zsbailong的博客 6041

浙大PTA-Python题库 编程题第三章(3-1~3-22)题解

其他各章题解链接如下 浙大PTA-Python题库 编程题第一章(1-1~1-3)题解 https://blog.csdn.net/zimuzi2019/article/details/107020657 浙大PTA-Python题库编程题 第二章(2.1~2.14)题解 https://blog.csdn.net/zimuzi2019/article/details/106984549 浙大PTA-Python题库 编程题第三章(3-1~3-22)题解 https://blog.csdn.net/zimu

zimuzi2019的博客 7万+

Python练习题——站队顺序输出

题目来源:Python语言程序设计(中国大学MOOC) 题目描述: 有一群人站队,每人通过一对整数(h, k)来描述,其中h表示人的高度,k表示在此人前面队列中身高不小于此人的总人数。 实现一个算法输出这个队列的正确顺序。 输入格式: 输入格式为二维列表,即 list[list[]]形式 外层list包含队列中全部的人,内层list为[h,k]格式,代表个人信息。 输出格式: ...

Ceres的博客 3661
上一篇: ybt1105 数组逆序
下一篇: luogu1046 陶陶摘苹果(NOIP2005普及组第1题)
WDAJSNHC
博客等级 码龄12年 71粉丝 409原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值