#include <cstdio>
#include <cstdlib>
struct my{
int id;
double rate;
};
int cmp(const void* a, const void* b ) {
return ((*(my *)a).rate > (*(my *)b).rate) ? 1 : -1;
}
int main() {
int n, init, finish, index, maxDiff;//n为实验组数,init为初始细菌数量, index为A类中的最后一个下标,maxDiff为最大繁殖数差
my a[101];//a为培养皿结构体,a[i]代表第i个培养皿
scanf("%d", &n);
for (int i = 1; i <= n; i++) {
scanf("%d %d %d", &a[i].id, &init, &finish);
a[i].rate = (double)(finish / init);
}
qsort(&a[1], n, sizeof(a[0]), cmp);
maxDiff = 0;
for (int i = 1; i < n; i++) {
int diff = a[i + 1].rate - a[i].rate;
if (diff > maxDiff) {
maxDiff = diff;
index = i;
}
}
printf("%d\n", n - index);
for (int i = index + 1; i <= n; i++) printf("%d\n", a[i].id);
printf("%d\n", index);
for (int i = 1; i <= index; i++) printf("%d\n", a[i].id);
return 0;
}
poj 细菌实验分组
最新推荐文章于 2023-03-03 00:01:05 发布