F WA最后三个求调
  • 板块学术版
  • 楼主code_hyx
  • 当前回复3
  • 已保存回复3
  • 发布时间2024/8/10 21:43
  • 上次更新2024/8/10 22:59:48
查看原帖
F WA最后三个求调
530797
code_hyx楼主2024/8/10 21:43
#include<bits/stdc++.h>
#define int unsigned long long
using namespace std;
int n,k,ans=1LL,bj[200005]={0};
struct node
{
	int x;
	int y;
};
node a[200005];
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	cin>>n>>k;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i].x>>a[i].y;
	}
	for(int i=1;i<=k;i++)
	{
		int maxx=0,mj=0;
		for(int j=1;j<=n;j++)
		{
			//cout<<j<<" "<<ans*a[j].x+a[j].y<<" "<<bj[j]<<"\n";
			if(ans*a[j].x+a[j].y>maxx&&bj[j]==0)
			{
				maxx=ans*a[j].x+a[j].y;
				mj=j;
			}
		}
		bj[mj]=1;
		ans=maxx;
		//cout<<ans<<"\n";
	}
	cout<<ans;
	return 0;
}
/*
2 2
50 100
100 1000
*/
2024/8/10 21:43
加载中...