当前位置: 首页 > news >正文

长沙网站建设做得好的/写软文

长沙网站建设做得好的,写软文,做简单网站用什么软件,做心理咨询可以在哪些网站发贴问题 A: 输出梯形 时间限制: 1 Sec 内存限制: 32 MB 题目描述 输入一个高度h&#xff0c;输出一个高为h&#xff0c;上底边为h的梯形。 输入 一个整数h(1<h<1000)。 输出 h所对应的梯形。 样例输入 5 样例输出 ******************************** ************…

问题 A: 输出梯形

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

题目描述

输入一个高度h,输出一个高为h,上底边为h的梯形。

输入

一个整数h(1<=h<=1000)。

输出

h所对应的梯形。

样例输入

5

样例输出

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

代码:

#include <iostream>
using namespace std;
int main()
{int h;while(cin>>h){int m=h+(h-1)*2;for(int i=0;i<h;i++){for(int j=0;j<m-h-2*i;j++){cout<<" ";}for(int j=0;j<h+2*i;j++){cout<<"*";}cout<<endl;}}return 0;
}

 

 

问题 B: Hello World for U

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

题目描述

 

Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. For example, "helloworld" can be printed as:

h  d

e  l

l  r

lowo

That is, the characters must be printed in the original order, starting top-down from the left vertical line with n1 characters, then left to right along the bottom line with n2 characters, and finally bottom-up along the vertical line with n3 characters. And more, we would like U to be as squared as possible -- that is, it must be satisfied that n1 = n3 = max { k| k <= n2 for all 3 <= n2 <= N } with n1 + n2 + n3 - 2 = N.

 

输入

 

Each input file contains one test case. Each case contains one string with no less than 5 and no more than 80 characters in a line. The string contains no white space.

 

输出

 

For each test case, print the input string in the shape of U as specified in the description.

 

样例输入

helloworld!

样例输出

e   d
l   l
lowor

分析:关键n1 = n3 = max { k| k <= n2 for all 3 <= n2 <= N }     关键max

先求n1和n3,正好整除向下取整,然后n2向里面加肯定最大

答案:

#include<iostream>
#include <string>
using namespace std;
int main(int argc, char const *argv[])
{string s;int N,n1,n2,n3;while(cin>>s){N=s.length();		n1=n3=(N+2)/3;n2=(N+2)-n1-n3;for(int i=0;i<n1-1;i++){cout<<s[i];for(int i=0;i<n2-2;i++){cout<<" ";}cout<<s[N-i-1]<<endl;}for(int i=n1-1;i<=N-n1;i++){cout<<s[i];}cout<<endl;}return 0;
}

 

 

问题 C: 等腰梯形

时间限制: 1 Sec  内存限制: 32 MB
提交: 329  解决: 209
[提交][状态][讨论版][命题人:外部导入]

题目描述

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

   ****

  ******

 ********

**********

输入

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

输出

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

 

样例输入

1
4

样例输出

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

 

代码:

#include <iostream>using namespace std;int main()
{int T;int h;while(cin>>T){while(T--){cin>>h;for(int i=0;i<h;i++){for(int j=0;j<h-i-1;j++)cout<<" ";for(int j=0;j<h+2*i;j++)cout<<"*";cout<<endl;}}}return 0;
}

 

 

问题 D: 沙漏图形 tri2str [1*+]

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

题目描述

问题:输入n,输出正倒n层星号三角形。首行顶格,星号间有一空格,效果见样例 
输入样例: 

输出样例:

* * ** * ** * 
* * *

数据规模 1<= n <=50 

代码:

#include <iostream>using namespace std;int main()
{int h;while(cin>>h){for(int i=0;i<h;i++){for(int j=0;j<i;j++){cout<<" ";}for(int j=0;j<h-i;j++){cout<<"* ";}cout<<endl;}for(int i=2;i<=h;i++){for(int j=0;j<h-i;j++){cout<<" ";}for(int j=0;j<i;j++){cout<<"* ";}cout<<endl;}}return 0;
}

 

 

http://www.lbrq.cn/news/818155.html

相关文章:

  • java网站开发新技术/卖友情链接赚钱
  • 国内出名网站建设设计公司/沈阳百度推广排名优化
  • 电商网站开发模块/长春网站快速排名提升
  • 网站改版后seo该怎么做/友谊平台
  • 爱情动作片做网站/关于市场营销的培训课程
  • 郑州好的网站建设公司/互联网销售是什么意思
  • 网站支付平台是怎么做的/外贸如何做网站推广
  • 商城网站的运营/郑州做网站的大公司
  • 网站舆论建设工作总结/竞价点击软件排名
  • 上海网站建设的价/百度推广是什么工作
  • 上海网站排名提升/2345手机浏览器
  • 游戏推广网站制作/seo能从搜索引擎中获得更多的
  • 旅游网站建设规划书模板下载/网站设计与制作
  • 去菲律宾做it网站开发/网站外贸推广
  • jsp网站建设项目实践/沈阳市网站
  • 买了香港主机后建站 写一个网站维修页面/爱站网关键词长尾挖掘
  • 网页制作大概需要多少钱/郑州seo课程
  • 沈阳网站建设报价/重庆关键词搜索排名
  • 想买个服务器做网站/如何免费做网站网页
  • 番禺有经验的网站建设/aso优化
  • 只做英文网站 域名有什么要求/昆明网络推广优化
  • 免费app软件/网站关键词排名优化电话
  • 网页制作与网站建设广州/网络游戏推广平台
  • 高质量摄影作品网站/贵州快速整站优化
  • 山东建设厅网站/游戏加盟
  • 域名举例/seo推广方法
  • 网站备案投诉/江苏关键词推广seo
  • 长沙网站建设icp备/专业的网页制作公司
  • 东莞网站建设做网站/网络推广怎么做?
  • 网站设计教程及在线模拟器/免费外贸接单平台
  • Linux随记(二十一)
  • 一些常见的网络攻击方式
  • 工程师实践出真知
  • VR 技术在污水处理领域的创新性应用探索​
  • 【模型剪枝1】结构化剪枝论文学习笔记
  • 人工智能概述