画图,用二维数组作为画布

 #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的更多相关文章

  1. 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 ...

  2. A1031. Hello World for U

    Given any string of N (>=5) characters, you are asked to form the characters into the shape of U. ...

  3. PAT A1031 Hello World for U (20)

    思路: 读取数组 int i = 0; while(cin >> word) { c[i] = word; i++; } 计算边长 int n1 = (length + 2) / 3; i ...

  4. 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 ...

  5. PAT/图形输出习题集

    B1027. 打印沙漏 (20) Description: 本题要求你写个程序把给定的符号打印成沙漏的形状.例如给定17个"*",要求按下列格式打印 ***** *** * *** ...

  6. 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 ...

  7. PAT题目AC汇总(待补全)

    题目AC汇总 甲级AC PAT A1001 A+B Format (20 分) PAT A1002 A+B for Polynomials(25) PAT A1005 Spell It Right ( ...

  8. PAT甲级题解分类byZlc

    专题一  字符串处理 A1001 Format(20) #include<cstdio> int main () { ]; int a,b,sum; scanf ("%d %d& ...

随机推荐

  1. 阶段2 JavaWeb+黑马旅游网_15-Maven基础_第1节 基本概念_03maven一键构建概念

    资料里面写好的Helloworld项目 pom.xml存放jar包的坐标 首先复制项目所在的目录的路径: 先进去复制的这个路径,然后又输入了d盘.这时候就进去到这个项目目录了. 这个项目就运行起来了. ...

  2. linux下搭建mysql数据库

    linux下搭建mysql数据库 1.下载mysql: http://dev.mysql.com/downloads/mysql/5.6.html#downloads wget http://dev. ...

  3. Struts2框架学习笔记1

    1,框架概述 1.1,什么是框架(了解) 将一些重复性的代码进行封装,简化程序员的编程操作,可以使得程序员在编码中把更多的精力放到业务需求的分析和理解上面,相当于一个半成品软件. 1.2,三大框架(掌 ...

  4. 初学node.js-nodejs中实现修改用户路由

    经过前面几次的学习,已经可以做下小功能,今天要实现的是修改用户路由. 一.users_model.js  功能:定义用户对象模型 var mongoose=require('mongoose'), S ...

  5. 网络编程.TCP分块接收数据(AIO)(IOCP)

    1.前提:每次投递的接收缓冲区 在它返回后 就不再用它进行2次投递了 于是 接收缓冲区 在返回的时候,数据都是 从接收缓冲区的偏移[0]处开始填充的,且 接收缓冲区 可能被填满 也可能未被填满. 1. ...

  6. 将python 2.6 升级到 2.7,及pip安装

    由于CentOS6.5 自带python版本为2.6.6,实际中使用的大多为2.7.x版本.于是手动升级. 查看python的版本 #python -VPython 2.6.6 1.下载Python- ...

  7. C#获取当前路径7中方法

    //获取模块的完整路径. string path1 = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName; //获取 ...

  8. [LeetCode] 45. 跳跃游戏 II

    题目链接 : https://leetcode-cn.com/problems/jump-game-ii/ 题目描述: 给定一个非负整数数组,你最初位于数组的第一个位置. 数组中的每个元素代表你在该位 ...

  9. 好用的 Puppeteer 辅助工具 Puppeteer Recorder

    Puppeteer Puppeteer 是一个Node库,它提供了一个高级API来控制DevTools协议上的Chrome或Chromium,常用于爬虫.自动化测试等,你在浏览器手动完成的大多数事情都 ...

  10. 第三方模块:gulp模块

    一.Gulp的使用 1. 使用npm install  gulp  下载gulp库文件 2. 在项目根目录下简历gulpfile.js文件 3. 重构项目的文件夹架构src目录放置源代码文件,dist ...