博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
寒假刷题之5——竹简文
阅读量:4644 次
发布时间:2019-06-09

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

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.

Input

Rene Decartes once said,"I think, therefore I am."

Output

"RIe nteh iDnekc,a rttheesreofnocree sIa iadm,."
   感觉好水啊这题,题目很容易就看懂了,为了搞清楚输入输出细节我借助了google翻译,结果"I think, therefore I am."这句名言变成了刘若英说的,让人捧腹。。。
   wa了几次,老会把空格打成a,定义ch数组时老是无法正常定义,遇到a条件输出空格也不行,不知道是错误出在哪里。。
#include
int main(){ int i = 0, j = 0, maxj = 0, maxi; char ch[100][100], temp; int row[100] = {0}; for (;(temp = getchar()) != EOF;){ if (temp == '\n'){ i ++; j = 0; } else if (temp != '\t'){ ch[i][j++] = temp; if (maxj < j) maxj = j; row[i] = j; } } maxi = i - 1; for (j = 0; j < maxj; j ++){ for (i = maxi; i >= 0; i --) printf("%c", j < row[i] ? ch[i][j]: ' '); printf("\n"); } return 0;}
   挺水的一题我做了也好久,看了我还是太弱了。。。

转载于:https://www.cnblogs.com/java20130723/archive/2013/02/01/3212279.html

你可能感兴趣的文章
C3P0连接池工具类使用
查看>>
SVN常用命令备注
查看>>
孩子教育
查看>>
解决Cacti监控图像断断续续问题
查看>>
结构体的传参理解成员的存储方式
查看>>
python 进程与线程(理论部分)
查看>>
什么是API
查看>>
Java反射中method.isBridge() 桥接方法
查看>>
[shiro学习笔记]第二节 shiro与web融合实现一个简单的授权认证
查看>>
强名称程序集(strong name assembly)——为程序集赋予强名称
查看>>
1028. List Sorting (25)
查看>>
BZOJ 1613: [Usaco2007 Jan]Running贝茜的晨练计划
查看>>
ubuntu 重启命令,ubuntu 重启网卡方法
查看>>
Linux的学习:
查看>>
JavaScript中的原型继承原理
查看>>
Python logger模块
查看>>
jquery控制css的display(控制元素的显示与隐藏)
查看>>
关于python做人工智能的一个网页(很牛逼)
查看>>
判断控件的CGRect是否重合,获取控件的最大XY值
查看>>
POJ-1128 Frame Stacking
查看>>