PersonalCorpus 版 (精华区)
寄信人: sino (茶水)
标 题: 408
发信站: 哈工大紫丁香 (2002年06月16日22:28:32 星期天)
来 源: 202.118.239.224
Your C++ program has solved Ok the problem 408 (Uniform Generator)
in 0.510 seconds using as much as 500 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 <math.h>
#include <ctype.h>
void main()
{
#ifndef ONLINE_JUDGE
freopen("c:\\uva\\input408.txt","r",stdin);
freopen("c:\\uva\\output408.txt","w",stdout);
#endif
char m[100000];
int i,j,k,s,n;
while (scanf("%d%d\n",&s,&n)==2) {
memset(m,0,sizeof(m));
i=0;
while (m[i]==0) {
m[i]=1;
i=(i+s)%n;
}
for (i=0;i<n;i++) if (m[i]==0) break;
printf("%10d%10d ",s,n);
if (i==n) printf("Good Choice\n\n"); else printf("Bad
Choice\n\n");
}
}
--
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)
页面执行时间:1.965毫秒