zoukankan      html  css  js  c++  java
  • 490 Rotating Sentences

     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,
    .
    "
    
    
    
    
    C++语言: Codee#23812
    01 char buf[max_size][max_size];
    02 int main()
    03 {
    04     int i;
    05     int len;
    06     int max_len = -1;
    07     memset(buf, 0, sizeof(buf));
    08     for(i = 0; gets(buf[i]); i++)
    09         if((len = strlen(buf[i])) > max_len)
    10             max_len = len;
    11     for(int j = 0; j < max_len; ++j)
    12     {
    13         for(int k = i - 1; k >= 0; --k)
    14             if(buf[k][j])
    15                 fprintf(fout, "%c", buf[k][j]);
    16             else if(j > 0)                     //blank
    17                 fprintf(fout, " ");
    18         fprintf(fout, "\n");
    19     }
    20
    21     return 0;
    22 }
  • 相关阅读:
    Windows共享作为公司文件服务器的案例
    关于限制域用户登陆计算机的几点总结
    防止加入域主机脱离域的控制(管理员权限)
    域组策略禁止执行指定软件
    域用户执行金蝶K/3报错解决方法
    WinXP/Win7/Win8本地用户配置文件迁移至域用户
    Windows批处理:请求远程协助
    浅谈JavaScript闭包
    新蛋那几月
    JavaScript 32位整型无符号操作
  • 原文地址:https://www.cnblogs.com/invisible/p/2237296.html
Copyright © 2011-2022 走看看