qidao123.com技术社区-IT企服评测·应用市场
标题:
codeforces B. Apples in Boxes
[打印本页]
作者:
欢乐狗
时间:
2025-5-10 19:28
标题:
codeforces B. Apples in Boxes
https://codeforces.com/contest/2107/problem/B
#include<bits/stdc++.h>
using namespace std;
#define int long long
const int N = 5e5 + 10;
void solve()
{
int n, k;
cin >> n >> k;
vector<int> a(n);
for(int i = 0; i < n; ++i) cin >> a[i];
int sum = accumulate(a.begin(), a.end(), 0LL);
if(sum%2==0)
{
cout << "Jerry" << endl;
return;
}
sort(a.begin(), a.end());
a.back()--;
sort(a.begin(), a.end());
if(a.back()-a.front() > k)
{
cout << "Jerry" << endl;
return;
}
else
{
cout << "Tom" << endl;
return;
}
}
signed main() {
int q;
cin >> q;
while (q--)
solve();
return 0;
}
复制代码
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
欢迎光临 qidao123.com技术社区-IT企服评测·应用市场 (https://dis.qidao123.com/)
Powered by Discuz! X3.4