QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#743854#9746. 平方根wyy0719TL 0ms0kbC++14914b2024-11-13 20:10:462024-11-13 20:10:48

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 20:10:48]
  • 评测
  • 测评结果:TL
  • 用时:0ms
  • 内存:0kb
  • [2024-11-13 20:10:46]
  • 提交

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;
}

詳細信息

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
...

result: