NYOJ34-韩信点兵 2

 1 #include<stdio.h>

 2 #include<stdlib.h>

 3 int main()

 4 {

 5     int a,b,c,t=10;

 6     scanf("%d%d%d",&a,&b,&c);

 7     while(1)

 8     {

 9         if((t%3==a)&&(t%5==b)&&(t%7==c))

10         {

11             printf("%d\n",t);

12             break;

13         }

14         if(t>100)

15         printf("No answer");

16         else

17         t++;

18     }

19     //system("pause");

20     return 0;

21 }

你可能感兴趣的:(OJ)