QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#825156 | #9750. 拼图 | LianYan | WA | 0ms | 3664kb | C++20 | 1.2kb | 2024-12-21 17:32:13 | 2024-12-21 17:32:17 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
int a, b, c, d;
int ans = 0;
cin >> a >> b >> c >> d;
int t = min(b, c);
// t >>= 1;
if (a < 4)
{
cout << 0 << endl;
return;
}
else
{
if (t == 0)
{
if (b >= 1 && c >= 1)
ans = 6;
else
ans = 4;
}
else if (d <= (t << 1) - 1)
{
ans = 4 + d + 2 * (d + 1);
}
else if (d >= t * t)
{
ans = 4 + t * 4 + t * t;
}
else
{
for (int i = t; i >= 1; i--)
{
if (d >= i * (2 * t - i))
{
ans = i * (2 * t - i) + 4 * t;
cout << i << endl;
break;
}
}
ans += 4;
}
}
ans = max(ans, 4 + min(b, c) * 2);
cout << ans << endl;
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
int T;
cin >> T;
while (T--)
solve();
return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3664kb
input:
2 4 0 0 0 4 4 4 4
output:
4 18
result:
wrong answer 2nd lines differ - expected: '16', found: '18'