2025:【例4.11】体操队
时间限制: 1000 ms 内存限制: 65536 KB
提交数:45169 通过数: 28503
【题目描述】
校体操队到操场集合,排成每行2人,最后多出1人;排成每行3人,也多出1人;分别按每行排4,5,6人,都多出1人;当排成每行7人时,正好不多。求校体操队至少多少人?
【输入】
如题述,无。
【输出】
校体操队人数。
例如:人数为15,直接输出15就可以啦。
【输入样例】
无
【输出样例】
无
#include<iostream>
using namespace std;
int main()
{
int num=7;
while (true)
{
if (num%2==1 and num%3==1 and num%4==1 and num%5==1 and num%6==1)
{
cout << num;
break;
}
num+=7;
}
}