UVaOJ 490
来源:互联网 发布:网络arp检测工具 编辑:程序博客网 时间:2024/05/15 07:21
UVaOJ 490 rotating sentences
题目:
In “Rotating Sentences,” you are asked to rotate a series of input sentences 90 degrees clockwise. So instead of displaying the input sentences from left to right and top to bottom, your program will display them from top to bottom and right to left.
Input and Output
As input to your program, you will be given a maximum of 100 sentences, each not exceeding 100 characters long. Legal characters include: newline, space, any punctuation characters, digits, and lower case or upper case English letters. (NOTE: Tabs are not legal characters.)
The output of the program should have the last sentence printed out vertically in the leftmost column; the first sentence of the input would subsequently end up at the rightmost column.
Sample Input
Rene Decartes once said,
“I think, therefore I am.”
Sample Output
“R
Ie
n
te
h
iD
ne
kc
,a
r
tt
he
es
r
eo
fn
oc
re
e
s
Ia
i
ad
m,
.
”
注意字符串中不够长的要以空格输出替代。
#include <stdio.h>#include <string.h>#define LOCAL#define MAXN 100 + 10char s[MAXN][MAXN];int main(void){ #ifdef LOCAL freopen("490.in", "rb", stdin); freopen("490.out", "wb",stdout); #endif // LOCAL int count = 0, maxn = 0, i, j; memset(s, 0, sizeof(s)); //初始化字符串 !!!重要 while((gets(s[count])) != NULL) { maxn = maxn >= strlen(s[count]) ? maxn : strlen(s[count]); count ++; } for(i = 0; i < maxn; i ++) { for(j = count - 1; j >= 0; j --) { if(s[j][i] == 0) putchar(' '); else putchar(s[j][i]); } putchar('\n'); } return 0;}
- UVaOJ 490
- uvaoj 490 - Rotating Sentences
- UVaOJ 490 - Rotating Sentences
- UVaOJ 490 Rotating Sentences
- UVaOJ 490 - Rotating Sentences
- UVaOJ 490 Rotating Sentences
- UVaOJ
- UvaOJ 401
- uvaoj 489
- uvaoj 457
- UVaOJ 537
- uvaoj 12283
- UVaOJ 11205
- UVaOJ 127
- UVAoJ --401
- UVaOJ UVaOJ 445 - Marvelous Mazes
- UVaOJ 401 Palindromes
- UVAOJ 414 - Machined Surfaces
- oracle 修改数据表字段
- Android添加一个Native Service
- caffe 网络结构几个部分简单介绍
- poj2828(线段树)
- Java中的泛型方法
- UVaOJ 490
- MATLAB聚类
- 设计模式
- vim+tags 安装使用
- Netty官方指南: User guide for 4.x
- ajax自动更新订单状态
- DataTable删除重复数据
- ExtJS 多文件上传
- java 泛型编程(一)