PersonalCorpus 版 (精华区)
寄信人: sino (茶水)
标 题: 490
发信站: 哈工大紫丁香 (2002年06月16日18:19:46 星期天)
来 源: 202.118.239.224
Your C++ program has solved Ok the problem 490 (Rotating Sentences)
in 0.000 seconds with low memory spent.
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <memory.h>
#include <ctype.h>
void main()
{
#ifndef ONLINE_JUDGE
freopen("c:\\uva\\input490.txt","r",stdin);
freopen("c:\\uva\\output490.txt","w",stdout);
#endif
char s[100][110];
char res[110];
int i,j,k,maxl,tot;
tot=0; maxl=0;
while(gets(s[tot])!=NULL) {
if (maxl<strlen(s[tot])) maxl=strlen(s[tot]);
tot++;
}
for (i=0;i<maxl;i++) {
for (k=0,j=tot-1;j>=0;j--,k++)
if (i<strlen(s[j])) res[k]=s[j][i]; else res[k]=' ';
res[k]=0;
printf("%s\n",res);
}
}
--
SecureNetTerm can be dowloaded to all countries except
Cuba, Iran, Iraq, Libya, North Korea, Sudan and Syria.
※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.239.224]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.165毫秒