PersonalCorpus 版 (精华区)

Your C++ program has solved Ok the problem 440 (Eeny Meeny Moo)
in 0.060 seconds using as much as 396 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\\input440.txt","r",stdin);
    freopen("c:\\uva\\output440.txt","w",stdout);
#endif

    int i,k,m,n;
    scanf("%d\n",&n);
    while (n!=0) {
        for (m=1;;m++) {
            k=0;
            for (i=2;i<n;i++)
                k=(k+m)%i;
            if (k==0) break;
        }
        printf("%d\n",m);
        scanf("%d\n",&n);
    }
}

[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.658毫秒