《算法竞赛经典入门完整版》习题

时间:2015-05-18 01:14:23   收藏:0   阅读:159

习题2-3 韩信点兵

#include<stdio.h>
#include<time.h>
int main()
{
    int a,b,c,S = 10;
    scanf("%d",&a);
    scanf("%d",&b);
    scanf("%d",&c);
    while(!(S%3 == a && S%5 == b && S%7 == c && S<101))
    {
        S++;
    }
    if(S>100) printf("no answer");
    else printf("%d",S);
    return 0;
}

本文出自 “Chronosphere” 博客,转载请与作者联系!

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!