#include<iostream>
using namespace std;
#define N 8
int main()
{
int m;
cout<<"输入人数"<<endl;
cin>>m;
if(m<=N)
{
cout<<"一组"<<m<<"人"<<endl;
}else if(m%8==0)
{
cout<<"一组"<<m/8<<"人"<<endl;
}else
{
int i=m/8+1;
int j=m/i+1;
int k=m-(j-1)*i;
cout<<k<<"组"<<j<<"人"<<" ";
cout<<i-k<<"组"<<j-1<<"人";
}
return 0;
}
运动员分组比赛;有N个人参加100米短跑比赛,有8条跑道,如何分组使分组数目最少且每组人数相差最少。
最新推荐文章于 2024-03-15 20:25:51 发布