TLE求条
查看原帖
TLE求条
1198462
dvsfanjo楼主2024/8/17 17:04

本人刚学 c++ 两天,现在 c++ 都这么难吗

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll a, b;
int main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cin >> a >> b;
	ll l = -1e18, r = 1e18;
	while (l < r)
	{
		ll mid = (l + r) >> 1;
		if (mid - b > a)
			r = mid - 1;
		else
			l = mid;
	}
	cout << l << '\n';
	return 0;
}
2024/8/17 17:04
加载中...