2003 Problem C 等腰梯形

打印直角三角形,等腰三角形、直角梯形、等腰梯形 public class Dasanyuan { public static void main(String[] args){ /** * 打印直角三角形 */ final int row = 5;//要打印几行 for(int i=1;i<=row;i++){ //负责打印一个由星号组成的等腰直角三角形 for(int k=0;k<i;k++){ 阅读详情

问题 C: 等腰梯形

时间限制: 1 Sec  内存限制: 32 MB

题目描述

请输入高度h,输入一个高为h,上底边长为h 的等腰梯形(例如h=4,图形如下)。

   ****

  ******

 ********

**********

输入

输入第一行表示样例数m,接下来m行每行一个整数h,h不超过10。

输出

对应于m个case输出要求的等腰梯形。

样例输入

1
4

样例输出

   ****
  ******
 ********
**********

经验总结

计算好输出星号和空格的关系就行啦,不难~~

AC代码

#include <cstdio>
#include <cstring>
int main()
{
	int m,h;
	scanf("%d",&m);
	for(int i=0;i<m;i++)
	{
		scanf("%d",&h);
		for(int j=0;j<h;j++)
		{
			for(int k=0;k<h-1-j;k++)
				printf(" ");
			for(int k=0;k<h+2*j;k++)
				printf("*");
			for(int k=0;k<h-1-j;k++)
				printf(" ");
			printf("\n");
		}
	}
	return 0;
}

 

2003:等腰梯形 题目描述 请输入高度h,输入一个高为h,上底边长为h 的等腰梯形(例如h=4,图形如下)。    ****   ******  ******** ********** 输入格式 输入第一行表示样例数m,接下来m行每行一个整数h,h不超过10。 输出 对应于m个case输出要求的等腰梯形。 样例输入 1 4 样例输出 阅读详情

相关推荐

等腰梯形[

等腰梯形 题目描述 请输入高度h,输入一个高为h,上底边长为h 的等腰梯形(例如h=4,图形如下)。 输入 输入第一行表示样例数m,接下来m行每行一个整数h,h不超过10。 输出 对应于m个case输出要求的等腰梯形。 样例输入 1 4 样例输出 /*等腰梯形: 1.将其看作一个二维图形,分析i与j之间的关系 2.每一行起始“*”均满足i+j>=h+1 结束“*”与该行有关(最后一行结束*极为下底边长,

大块儿肉的博客 543

问题 C: 等腰梯形

题目描述 请输入高度h,输入一个高为h,上底边长为h 的等腰梯形(例如h=4,图形如下)。    ****   ******  ******** ********** 输入 输入第一行表示样例数m,接下来m行每行一个整数h,h不超过10。 输出 对应于m个case输出要求的等腰梯形。   样例输入 1 4 样例输出 **** ****** *******...

Mr_Zhangmc的博客 1053

c等腰梯形

c等腰梯形

C/C++[codeup 2003, 2056]图形输出

2003题目描述;等腰梯形 请输入高度h,输入一个高为h,上底边长为h 的等腰梯形(例如h=4,图形如下)。 **** ****** ******** ********** 输入 输入第一行表示样例数m,接下来m行每行一个整数h,h不超过10。 输出 对应于m个case输出要求的等腰梯形。 样例输入 2 3 4 样例输出 #include &lt;iostre...

机器会学习的博客 701

百度地图街景图像批量获取

由于个人研究需要在最近试了一下使用API获取百度地图街景图片,在此介绍一下基于我个人需求的百度街景批量获取方法,本文以Python编码作为主要方法,如果对零编码工具有需要的可以关注一下UA城市分析小组刚刚发布的街景图片获取工具。 街景图像用作区域细粒度空间指标测度需要解决几个问题。 1. 首先就是调用额度的限制,现在百度对于个人认证开发者每天可用的街景图像调用额度为100张,在不考虑购买额度上限(1万张600元,其实有经费的前提下可以直接考虑钞能力)的情况下动辄几千上万张的爬取数量会大大增加需要爬取的时间周

boycetoon29的博客 1万+

在pycharm2021.2中学习opencv图像处理,基于python3.9.7、pycharm完成配置

在pycharm中学习opencv图像处理安装python下载python安装包开始安装安装pycharm社区版下载pycharm开始安装如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 安装python 使用pycharm学习opencv应该是最简单的了,对新手比较友好,

steveqobs 7716

输出一个等腰梯形

#include<stdio.h> int main() { int i,j,n; scanf("%d",&n); for(j=1;j<=n;j++) { for(i=2*(n-j);i>0;i--) printf(" "); for(i=n-2+2*j;i>0;i--) printf("* "); printf("\n"); } return 0; } ...

yydsyd的博客 1504

文章详细介绍了进行DoIP(DiagnosticoverInternetProtocol)测试的完整过程,包括样件的正确接线、CANoe软件的环境配置、端口设置、VLAN配置、IP和MAC地址的设定

关于Tester和DUT的地址,其实最主要的就是DUT的IP、MAC和逻辑地址,如果不知道Tester的IP、MAC和逻辑地址,可以配置为与DUT同一网段的就可以。ps:最重的是知道DUT的IP、逻辑、MAC地址,如果有VLAN也需要知道,Tester的地址可以根据DUT地址进行设定,其余的值可根据DoIP的报文查到相关参数。ps:如果在通信中没有建立VLAN,但是源地址和目的地址都填写正确,此时就要考虑是否是遗漏了VLAN,建立一个VLAN,在重新试试是否可通信。此处与硬件连接是相对应的,要注意!

qq_40965861的博客 1136

等腰梯形

Description 对于一个整数n(n >= 2),输出对应形状的等腰梯形。 Input 一个整数n为梯形的高与上底的长度。 Output 输出对应的图形。 Sample Input 1 3 Sample Output 1 *** * * ******* #include<stdio.h> int main() { ...

weixin_45798287的博客 1160

SAP-ML章<<<<第二节:物料账报错处理ABAP编程错误:RAISE_EXCEPTION>>>>

#SAP-ML章<<<<第一节:物料账报错处理ABAP编程错误:RAISE_EXCEPTION>>>> 1.物料账报错提示: ABAP编程错误:RAISE_EXCEPTION ABAP程序:SAPLFCML4H_RUN_PRICES应用组件CO-PC-ACT 2. 物料账报错背景: CKMLCP运行结算时 3. 解决方案: 通过DEBUG查看错误的地方 OKTZ:分析原因为:可能打包或者配置传输时弄错 ...

SAP.David.Gao的博客 1862

论文理解【LLM-Clarification】—— 【QDrawer】Asking the Right Question at the Right Time: Human and Model Unce

本文基于 CoDraw 任务对 LLM 澄清提问的触发方式进行探索,发现模型内部不确定性与人类澄清决策相关性弱,使用不确定性阈值触发澄清提问相比模仿人类提问时机,性能和计算效率都更好

佚失的诗篇 783

2003 Problem C

题目描述请输入高度h,输入一个高为h,上底边长为h 的等腰梯形(例如h=4,图形如下)。   ****  ****** ******************输入输入第一行表示样例数m,接下来m行每行一个整数h,h不超过10。输出对应于m个case输出要求的等腰梯形。样例输入1 4样例输出 **** ****** ******** **********思路:此题目与1933 problem...

privilage的博客 160

基于综合阻抗特征的配电架空线路单相断线故障区段定位研究

本文提出了一种基于综合阻抗特征的配电架空线路单相断线故障区段定位方法。通过分析故障后正序、负序阻抗变化,构造综合阻抗判据实现精准定位。仿真结果表明:该方法能有效识别故障区段,差异度判据显著(故障区段达0.508,非故障区段<0.016);对过渡电阻(1-200Ω)和负荷变化具有强鲁棒性,定位准确率不受影响。相比传统方法,综合阻抗法放大了断线故障特征,解决了弱故障信号检测难题,为配电网安全运行提供了可靠的技术手段。

AI的内部世界的博客 87

输出图形(等腰三角形)(等腰梯形)

等腰三角形#include&lt;stdio.h&gt; int main() { int n; scanf("%d",&amp;n); if(n&lt;=0) printf("error\n"); for(int i=1;i&lt;=n;i++) { int j=2*i-1,t=n-i; while(t--) printf(" "); while(j--) ...

嘘嘘不去的博客 2827

【PX4学习笔记】3. PX4 固件烧写(1 探索过程)

飞控型号:cube orange【PX4官方用户指南中关于cube orange的描述】 飞控载板型号:Mini Carrier Board【迷你载板说明文档】 固件安装参考:The Cube User Manual V1.0

【人工智障 | 计算鸡视觉 | 机器孩】 7679

功能安全实战系列07-英飞凌TC3xx电源监控开发详解

本文对电源监控(PBIST及MONBIST)开发介绍,步骤详细配合开发中的测试情况,图文并茂,方便理解。

initiallizer的博客 1119

c#控制台,画等腰梯形

/ * 4 3 2 1 0 5行。Console.WriteLine("请输入行数:");namespace 等腰三角形。

insidecleverboy的博客 287

假人有限元模型

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

C++题目:面积

大家好!第三篇博客开始!

Duyea2012的博客 1060

Devexpress16.2.6破解工具

Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具Devexpress16.2.6破解工具

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

C++实验

C++实验二 类与对象 一二、实验内容:1、 编写一个程序,该程序中包含一个梯形类(数据成员:上底、下底、高)和一个圆形类(数据成员:半径)。这两个类都提供计算周长和面积的操作。在主函数中分别测试这两个类。2、 编写一个程序,该程序中包含一个Student类,Student类中至少应包含学号、姓名、年龄和成绩等信息;操作包括设置学生信息初值、获得学生成绩、显示学生所有信息和修改学生姓名等。在主函数中对该类进行测试。3、 编写一个程序,该程序中包含一个Point类,Point类中含有x,y坐标信息;为该类编写

m0_46147064的博客 1724

pscad IEEE标准系统搭建说明

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

星号等腰梯形

Description 已知星号等腰梯形的层数为h,最上面一层的星号个数为a,以后每层比上一层多两个星号,要求最底下一层的第一个星号前面没有空格,请编程序画出这个等腰梯形。画梯形的过程要求用函数实现 Input 输入只有一行,两个用空格隔开的正整数h和a,分别表示层数和最上面一层的星号个数。1<=h,a<=20。 Output 输出符合要求的图案。 Sample Input 6 4 Sample Output **** ****** *******

dn2021c216的博客 900

codeup|问题 C: 等腰梯形

题目描述 请输入高度h,输入一个高为h,上底边长为h 的等腰梯形(例如h=4,图形如下)。 输入 输入第一行表示样例数m,接下来m行每行一个整数h,h不超过10。 输出 对应于m个case输出要求的等腰梯形。 样例输入 Copy 1 4 样例输出 Copy 代码 #include<stdio.h> int main() { int h, m; scanf("%d", &m); while (m--) { scanf("%d", &

weixin_43340821的博客 232

算法笔记:等腰梯形

题目 请输入高度h,输入一个高为h,上底边长为h 的等腰梯形(例如h=4,图形如下)。 **** ****** ******** ********** 输入 输入第一行表示样例数m,接下来m行每行一个整数h,h不超过10。 输出 对应于m个case输出要求的等腰梯形。 案例 1 4 **** ****** ******** ********** 代码 #include <stdio.h> int main(){ int m,h; while(scanf("%d"

Bamboo9999的博客 463

《算法笔记》3.3小节——入门模拟->图形输出

目录 问题 A: 输出梯形 问题 B: Hello World for U 问题 C: 等腰梯形 问题 D: 沙漏图形 tri2str [1*+] 问题 A: 输出梯形 题目描述 输入一个高度h,输出一个高为h,上底边为h的梯形。 输入 一个整数h(1<=h<=1000)。 输出 h所对应的梯形。 样例输入 5 样例输出 ***** ...

wyatt007的博客 398

c语言编程等腰梯形,c或c++编程,输出倒置等腰梯形及矩形

满意答案Krine2013.08.28采纳率:47%等级:11已帮助:5950人/*win 7不支持TC全屏,故下面的代码,WIN7下面的TC应当过不去,XP应当可以*/#include#include#include#include#includemain(){int gdriver = DETECT, gmode, errorcode;float d1,d2,h,x0=100,y0=1...

weixin_39970855的博客 2080
上一篇: 1993 Problem B Hello World for U
下一篇: 2506 Problem D 沙漏图形 tri2str [1*+]
漫浸天空的雨色
博客等级 码龄15年 1303粉丝 523原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

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

抵扣说明:

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

余额充值