签到题,按照题意模拟即可。遍历整个数组,当 $a_i \le 10 $ 时,用 \(b_i\) 更新最大值即可。
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main()
{
int T,n,a,b,ans,mx;
cin >> T;
while( T -- )
{
mx = 0;
ans = 0;
cin >> n;
for( int i = 1 ; i <= n ; i ++ )
{
cin >> a >> b;
if( a <= 10 )
{
if( b > mx )
{
mx = b;
ans = i;
}
}
}
cout << ans << endl;
}
return 0;
}
标签:int,CF1850B,cin,long,ans,mx
From: https://www.cnblogs.com/-lilong-/p/17976908