求助U456677,只a了一个点,玄关
  • 板块题目总版
  • 楼主osu_rice222
  • 当前回复15
  • 已保存回复15
  • 发布时间2024/7/28 09:37
  • 上次更新2024/7/28 10:50:19
查看原帖
求助U456677,只a了一个点,玄关
1246000
osu_rice222楼主2024/7/28 09:37
#include <bits/stdc++.h>
using namespace std;
struct node{
	int t,data;
	double pp;
}a[25];
int t,p;
double x;
bool cmp(node x,node y){
	if(x.t!=y.t){
		return x.t>y.t;
	}
	else{
		return x.pp>y.pp;
	}
}
int main(){
	ios::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++){
		cin>>t>>p>>x;
		a[i].t=t,a[i].pp=p*x,a[i].data=i;
	}
	sort(a+1,a+1+n,cmp);
	cout<<a[1].data;
	return 0;
}

2024/7/28 09:37
加载中...