题解分享
题解分享简介
合并检测(结果填空) - 题解
```
#include<bits/stdc++.h>
```
```
using namespace std;
```
```
//传入n个人一组,返回n个人一组
```
int dfs(int n)
{
int cnt=0;
```
int s=100;
```
cnt=(s/n)+n;//所需的试剂数量,比如(100/20)+20(因为是1%所以必有一个阳性)
```
if(s/n!=n)//剩余的不到一组,每个人都要做检测
{
cnt+=(s%n);
}
return cnt;
```
}
int main()
{
```
int min=100,b=0,a=0;//检测为100人
for(int i=1;i<=100;i++)//进行枚举i人一组
{
a=dfs(i);
if(min>a)
{
min=a;//记录最小的试剂数
b=i;//记录最小的试剂数对应最小i人一组
}
}
printf("%d\n",b);
return 0;
```
}
查看全文
0
0
0
2



