概述
//传送门:http://acm.hdu.edu.cn/showproblem.php?pid=2091
#include <queue>
#include <functional>
#include <stdio.h>
#include <string.h>
#include <iostream>
#include <algorithm>
#include <stack>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <assert.h>
using namespace std;
#define N 100005
//坑点:注意行末不要有空格; 注意仅在图形间换行
char ch;
int main()
{
bool flag = 0;
while(scanf("%c",&ch),ch!='@'){
//不建议使用 scanf("%c",ch) 或者 getchar()
因为会取走回车; 建议用 scanf("%s",s) 或者 cin>>sting 注意这时候要用"@"
if(flag) printf("n");
flag = 1;
int n;
scanf("%d",&n);
getchar();
//取走输入n后 按的回车
for(int i=0;i<n;i++){
//算是比较简洁的写法
for(int j=0;j<i+n;j++){
if(j==n-1-i || j==n-1+i || i==n-1) printf("%c",ch);
else printf(" ");
}
printf("n");
}
}
return 0;
}
最后
以上就是能干紫菜为你收集整理的HDU-2091-空心三角形(入门题)的全部内容,希望文章能够帮你解决HDU-2091-空心三角形(入门题)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复