PersonalCorpus 版 (精华区)

寄信人: ooze (烂泥~苦读武侠中)
标  题: 151
发信站: 哈工大紫丁香 (2002年06月19日13:12:01 星期三)
来  源: 202.118.239.224 

Your C++ program has solved Ok the problem 151 (Power Crisis)
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 <math.h>
#include <ctype.h>


void main()
{
#ifndef ONLINE_JUDGE
    freopen("c:\\uva\\input151.txt","r",stdin);
    freopen("c:\\uva\\output151.txt","w",stdout);
#endif
    int i,j,n,step;
    scanf("%d\n",&n);
    do  {
        for (step=1;;step++) {
            j=0;
            for (i=2;i<n;i++) {
                j+=step;
                j%=i;
            }
            if (j==11) {
                printf("%d\n",step);
                break;
            }
        }
        scanf("%d\n",&n);
    } while (n>0);
}

※ 来源:·哈工大紫丁香 bbs.hit.edu.cn·[FROM: 202.118.239.224]
--
※ 转寄:.哈工大紫丁香 bbs.hit.edu.cn.[FROM: 202.118.239.224]
[百宝箱] [返回首页] [上级目录] [根目录] [返回顶部] [刷新] [返回]
Powered by KBS BBS 2.0 (http://dev.kcn.cn)
页面执行时间:2.924毫秒