博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
PAT 1031 Hello World for U
阅读量:6931 次
发布时间:2019-06-27

本文共 813 字,大约阅读时间需要 2 分钟。

 

模拟题

1 #include 
2 #include
3 char words[100]; 4 int main() 5 { 6 scanf("%s",words); 7 //先确定底部的长度 8 int i; 9 int n2;10 for(i=3;;i++) {11 if((strlen(words)-i)%2==0&&((strlen(words)-i)/2+1<=i)){12 n2=i;13 break;14 }15 }16 17 // int n2=i;18 int height=(strlen(words)-i)/2;19 20 char *p=words;21 char *q=words+strlen(words)-1;22 23 while(height--) {24 putchar(*p);25 p++;26 int i;27 for(i=1;i<=n2-2;i++) putchar(' ');28 putchar(*q);29 putchar('\n');30 q--;31 }32 while(n2--) {33 putchar(*p);34 p++;35 }36 putchar('\n');37 return 0;38 }39

转载于:https://www.cnblogs.com/yangce/archive/2012/06/12/2546586.html

你可能感兴趣的文章
Myeclipse7.5 下载 安装 注冊 注冊码 100%成功
查看>>
按键驱动的恩恩怨怨之查询方式
查看>>
SOCKet 编程 简介
查看>>
C/C++产生随机数
查看>>
java集合经常出现空指针问题的解决方案
查看>>
Scala Trait
查看>>
[原]Android打包之Eclipse打多渠道包
查看>>
表单验证的3个函数ISSET()、empty()、is_numeric()的使用方法
查看>>
bat启动/停止oracle服务
查看>>
一、UITableView的属性
查看>>
python setuptools工具打包
查看>>
UVa 101 The Blocks Problem
查看>>
指针二次释放(_BLOCK_TYPE_IS_VALID)
查看>>
【转】每天一个linux命令(51):lsof命令
查看>>
copy_to_user 和 copy_from_user
查看>>
【MVC】 文件及URL 的整理
查看>>
【玩转Golang】reflect.DeepEqual
查看>>
python中的commands模块,执行出错:'{' 不是内部或外部命令,也不是可运行的程序 或批处理文件。...
查看>>
【调侃】IOC前世今生(转载)
查看>>
DLog的使用
查看>>