QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#743854 | #9746. 平方根 | wyy0719 | TL | 0ms | 0kb | C++14 | 914b | 2024-11-13 20:10:46 | 2024-11-13 20:10:48 |
answer
#include<bits/stdc++.h>
//#define int long long
using namespace std;
using ll = long long;
using ull = unsigned long long;
const int INF = 0x3f3f3f3f;
const ll mod = 1e9 + 7;
const int N = 2e5 + 5;
void wyy() {
int a , b , c , d;
cin >> a >> b >> c >> d;
int mn = min(b , c);
if (a < 4)
{
cout << "0\n";
return ;
}
int ans = 4 + mn * 2;
for (int i = 0 ; i <= 1000 ; i++)
{
for (int j = 0 ; j <= 1000 ; j++)
{
if ((!i || !j) && max(i , j) <= mn) ans = max(ans , 4 + 2 * max(i , j));
else if (i * j <= d && i + j <= mn) ans = max(ans , 4 + 2 * (i + j) + i * j);
else break;
}
}
cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);cout.tie(nullptr);
int T = 1;
cin >> T;
while (T--) wyy();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
1100110111
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...