hanxin

来源:互联网 发布:js let 编辑:程序博客网 时间:2024/04/29 14:56
#include <iostream>
#include<stdio.h>
using namespace std;
void hanxin(int a,int b,int c)
{
    int temp,i;
    for(i=1;i<14;i++)
     for(int j=2;j<20;j++)
     {
        temp=c+7*i;
        if((5*j+b)==temp)
        {
            for(int k=3;k<33;k++)
             if((3*k+a)==temp)
             {
             printf("%d\n",temp);return;               //此处用break会出现即使有结果如2 1 6也输出41 No answer
             }
        }
     }
    if(i==14)
     printf("No answer\n");
}


int main()
{
    int a,b,c;
    while(scanf("%d%d%d",&a,&b,&c)!=EOF){
    hanxin(a,b,c);
    }
    return 0;
}
1 0