#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include <ctype.h>
int main()
{
//
// //假设有1个兵
// if(1%3==1 && 1%5==1 && 1%7==1)
//
// //假设有2个兵
// if(2%3==1 && 2%5==1 && 2%7==1)
// //....
// //假设有i个兵
// if(i%3==1 && i%5==1 && i%7==1)
int a; //按a人一排
int b; //按b人一排
int c; //按c人一排
int yu; //表示余数
printf("请输入排兵方式及余数:");
scanf("%d%d%d%d", &a, &b, &c, &yu);
for(int i = 1; i < 700; i++){ //穷举法
if(i % a/*3*/ == yu && i % b/*5*/ == yu && i % c/*7*/ == yu){
printf("韩信至少有%d个兵\n", i);
}
}
return 0;
}