分开字符

#include <stdio.h>

  #include <string.h> 

#define MAX 105 

  char set[MAX][MAX];

    int main()  {

      int i, j, count = 0, length_max = 0;

      for ( ;fgets(set[count], MAX, stdin); count++)

      {

          if ((i = strlen(set[count])) > length_max)

              length_max = i;      } 

    for (i = 0; i < length_max - 1; i++)

      { 

        for (j = count - 1 ; j >= 0; j--)

              if (i < strlen(set[j]) - 1) 

                printf("%c", set[j][i]); 

            else

                  printf(" ");

          printf("\n");      } 

    return 0; 

http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&category=&problem=431&mosmsg=Submission+rec

#include<stdio.h>

#include<string.h>

int main(){

    int t,h,i=0;

    char a[120],b[120];

    gets(a);

    gets(b);

    t=strlen(a);

    h=strlen(b);

    while(i<t||i<h){

    if(i<t&&i<h)

    printf("%c%c\n",b[i],a[i]);

    else if(i>t)

    printf("%c \n",b[i]);

    else printf(" %c\n",a[i]);

    i++; }

    return 0;

    } 觉得自己是对的,无奈,又是错 网上的

#include <stdio.h> 

#include <string.h> 

#define N 110  int main(void) 

{      char s[N][N];

    int i, j, k, max; 

    for (i = max = 0, memset(s, ' ', sizeof(s));

fgets(s[i], N, stdin); i++)   

       if (strlen(s[i]) > max)  

            max = strlen(s[i]); 

    for (j = 0; j < max-1; j++) {

          for (k = i-1; k >= 0; k--) 

                s[k][j] != '\n' && s[k][j] ? putchar(s[k][j]) : putchar(' ');

          printf("\n"); 

    } 

    return 0;  }

按下面形式输出字符,其间有空格,如果句子字符不足,用空格代替 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,

. "

posted @ 2013-02-28 19:11  L kill  阅读(176)  评论(0编辑  收藏  举报