A1031
画图,用二维数组作为画布
#include<cstdio>
#include<string.h>
int main(){
char c[],u[][];
scanf("%s",&c);
memset(u,' ',sizeof(u));
int n=strlen(c)+;
int n1=n/,n2=n/+n%,index=;
for(int i=;i<n1;i++) u[i][]=c[index++];
for(int i=;i<=n2-;i++)u[n1-][i]=c[index++];
for(int i=n1-;i>=;i--)u[i][n2-]=c[index++];
for(int i=;i<n1;i++){
for(int j=;j<n2;j++) printf("%c",u[i][j]);
printf("\n");
}
return ;
}
A1031的更多相关文章
- A1031 Hello World for U (20)(20 分)
A1031 Hello World for U (20)(20 分) Given any string of N (>=5) characters, you are asked to form ...
- A1031. Hello World for U
Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. ...
- PAT A1031 Hello World for U (20)
思路: 读取数组 int i = 0; while(cin >> word) { c[i] = word; i++; } 计算边长 int n1 = (length + 2) / 3; i ...
- PAT甲级——A1031 Hello World for U
Given any string of N (≥) characters, you are asked to form the characters into the shape of U. For ...
- PAT/图形输出习题集
B1027. 打印沙漏 (20) Description: 本题要求你写个程序把给定的符号打印成沙漏的形状.例如给定17个"*",要求按下列格式打印 ***** *** * *** ...
- 1031 Hello World for U (20 分)
1031 Hello World for U (20 分) Given any string of N (≥5) characters, you are asked to form the chara ...
- PAT题目AC汇总(待补全)
题目AC汇总 甲级AC PAT A1001 A+B Format (20 分) PAT A1002 A+B for Polynomials(25) PAT A1005 Spell It Right ( ...
- PAT甲级题解分类byZlc
专题一 字符串处理 A1001 Format(20) #include<cstdio> int main () { ]; int a,b,sum; scanf ("%d %d& ...
随机推荐
- jmeter函数介绍(1)
1._Random() 随机数 The minimum value allowed for a range of values:输入一个最小值: The maximum value allowed f ...
- ugui点击穿透判断
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Eve ...
- eclipse sts 快捷键
1. ctrl + m 全屏/取消全屏 2.快速切换上面标签 ctrl + pageup/pagedown : 标签左右切换 ctrl + < > : 标签前后访问处切换 New Ja ...
- 手把手教你SOAP访问webservice并DOM解析返回的XML数据(转)
http://blog.csdn.net/u012534831/article/details/51357111 前言: 目前我们项目组还在采用webservice这种http方式,并且某些网站服务提 ...
- 题解 CF292A 【SMSC】
蒟蒻本想发一篇黑题题解,没想到黑题竟然掉紫了QwQ. 趁着题解还只有几篇,赶紧来发一篇嘿嘿嘿. 这道题其实很简单,题解其实都不需要 AC代码: #include<bits/stdc++.h> ...
- django中配置MySql
1.配置字段 在setting文件中配置数据库字段:数据库需要提前手动创建好:语句(create database testdb charset "utf8";) DATABASE ...
- FTP连接不上的解决方法
1.注意内网IP和外网IP 2.检查ftp服务是否启动 (面板首页即可看到) 3.检查防火墙20端口 ftp 21端口及被动端口39000 - 40000是否放行 (如是腾讯云/阿里云等还需检查安全组 ...
- java交换两个变量值a,b的多钟方法
首先我们定义两个变量用来检查方法可行性 int a=5; int b=3; 方法一,也是最容易想到的,就是建立中间变量法 int temp; temp=a; a=b; b=temp; System.o ...
- UVa11538 A Chess Queen
A Chess Queen Problem A Chess Queen Input: Standard Input Output: Standard Output You probably know ...
- 〇——什么是SHELL
在这段时间里中我们了解一下SHELL编程. 什么是shell shell是Linux的命令解释器,用于解释用户对操作系统的操作. 用shell解释的Linux命令有很多,可以通过cat/etc/she ...