#39119: 想請教為何我的程式結果一直是WA呢??哪裡出問題呢??


sj340821 (Jhangjhewei)

學校 : 正修科技大學
編號 : 68217
來源 : [49.217.126.74]
最後登入時間 :
2024-04-10 16:30:03
c045. 00490 - Rotating Sentences -- UVa490 | From: [180.217.210.79] | 發表日期 : 2024-01-16 22:15

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
/* run this program using the console pauser or add your own getch, system("pause") or input loop */
 
int main(int argc, char *argv[]) {
char data[100][100] = {0};
int i,j,count,max_length = 0;
 
while(fgets(data[count],100,stdin)){
if(max_length > sizeof(data[count])){
max_length = max_length;
}else{
max_length = sizeof(data[count]);
}
count ++;
}
 
for(i=0;i<max_length;i++){
for(j=count-1;j>=0;j--){
if(i>=sizeof(data[j])){
if(j!=0){
printf(" ");
}else{
printf("");
}
}else{
printf("%c", data[j][i]);
}
}
printf("\n");
}
return 0;
}
 
ZeroJudge Forum