Time Limit: 3000MS | Memory Limit: Unknown | 64bit IO Format: %lld & %llu |
Description

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>
int main()
{
char st[102][102],ch;
int maxlen = 0,top = 0,lenth[102];
while((gets(st[top])) != NULL)
{
if(strlen(st[top]) > maxlen)
maxlen = strlen(st[top]);
lenth[top] = strlen(st[top]);
top++;
}
int i,j,k;
for(i = 0;i < maxlen; i++)
{
for(j = top-1;j >= 0; --j)
{
if(lenth[j] > i)
printf("%c",st[j][i]);
else//其实所谓的细节就是在某一行的没有字符的位置,输出空格
printf(" ");
}
printf("\n");
}
return 0;
}