首页 > 其他 > 详细

poj 1012

时间:2014-01-21 21:27:23      阅读:506      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
#include <stdio.h>
#include <string.h>
#include <time.h>

double start,finish;

int check(int m, int k)
{
    int remainder = 0;
    int position = 0;
    int count = 0;
    
    for(count = 2 * k; count != k; count--)
    {
        remainder = m % count;
        position = (remainder + position + 1) % count;
        if(position <= k)
        {
            return 0;
        }
    }
    
    return 1;
}

int main(int argc, char *argv[])
{
    int m = 0;
    int k = 0;
    
    scanf("%d", &k);
    
    m = k + 1;

    while(1)
    {
        if(check(m, k))
        {
            break;
        }
        
        m++;
    }

    printf("%d", m);
    
    return 0;
}
bubuko.com,布布扣

poj 1012

原文:http://www.cnblogs.com/reasontom/p/3528737.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!