90pts求条
查看原帖
90pts求条
1345783
BK小鹿楼主2024/10/20 22:20

rt,没想明白哪错了

#include <iostream>
#include <cstdio>
#include <algorithm>

using namespace std;

const int N = 1e5 + 5;

int n;
int x[N];

int main()
{
	long long ans = 0;
	scanf("%d", &n);
	for (int i = 1; i <= n; i ++ )
	{
		int a, b;
		scanf("%d%d", &a, &b);
		x[i] = max(b, a - b);
	}
	sort(x + 1, x + n + 1);
	reverse(x + 1, x + n + 1);
	ans += x[1] + x[2];
	printf("%lld\n", ans);
	return 0;
}
2024/10/20 22:20
加载中...