PersonalCorpus 版 (精华区)

寄信人: sino (茶水)
标  题: 483
发信站: 哈工大紫丁香 (2002年06月16日19:08:42 星期天)
来  源: 202.118.239.224 

Your C++ program has solved Ok the problem 483 (Word Scramble)
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\\input483.txt","r",stdin);
    freopen("c:\\uva\\output483.txt","w",stdout);
#endif

    char ch;
    char now[5001];
    int i,j,k;

    k=0;
    while (1) {
        ch=getchar();
        if ((ch!=' ')&&(ch!=0x0d)&&(ch!=0x0a)&&(ch!=EOF)) {
            now[k]=ch;
            k++;
            continue;
        } else if (k>0){
            for (i=k-1;i>=0;i--) printf("%c",now[i]);
            k=0;
        }
        if (ch!=EOF) putchar(ch); else break;
    }
}

--
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)
页面执行时间:8.069毫秒