PersonalCorpus 版 (精华区)
寄信人: sino (茶水)
标 题: 484
发信站: 哈工大紫丁香 (2002年06月16日19:35:05 星期天)
来 源: 202.118.239.224
Your C++ program has solved Ok the problem 484 (The Department of
Redundancy Department)
in 0.350 seconds using as much as 908 kbytes of virtual memory.
#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\\input484.txt","r",stdin);
freopen("c:\\uva\\output484.txt","w",stdout);
#endif
int a[65535];
int b[65535];
int i,j,k,n;
char now [10];
char ch;
memset(a,0,sizeof(a));
k=0; n=0;
while (1) {
ch=getchar();
if ((isdigit(ch))||(ch=='-')) {
now[k]=ch;
k++;
continue;
} else if (k>0) {
now[k]=0; k=0;
sscanf(now,"%d",&i);
for (j=0;j<n;j++) if (b[j]==i) break;
if (j==n) { b[n]=i; n++; }
a[j]++;
}
if (ch==EOF) break;
}
for (i=0;i<n;i++) printf("%d %d\n",b[i],a[i]);
}
--
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)
页面执行时间:3.060毫秒