QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#497016#9134. Building a Fenceucup-team4361WA 0ms3628kbC++20982b2024-07-28 18:12:132024-07-28 18:12:13

Judging History

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

  • [2024-07-28 18:12:13]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3628kb
  • [2024-07-28 18:12:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

inline int read() {
    int x = 0, f = 1;
    char c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') f = -1;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        x = x * 10 + c - '0';
        c = getchar();
    }
    return x * f;
}

inline int Work(int a, int b, int c) {
    if (a < b) {
        swap(a, b);
    }

    if (c <= b) {
        return (2 * (a + b) + c - 1) / c;
    }

    if ((a + b) * 2 % c == 0 && (a + b) * 2 / c > 1) return (a + b) * 2 / c;

    if (c >= a) {
        if (c == a + b) return 2;
        if (c == 2 * a || c == 2 * b) return 3;
        if (2 * (c - a) == b || 2 * (c - b) == a) return 3;
        return 4;
    }

    return 1 + (2 * (a + b) + c - 1) / c;
}

int main() {
    int T = read();
    while (T--) {
        int a = read(), b = read(), c = read();
        cout << Work(a, b, c) << endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3628kb

input:

7
7 9 4
1 1 2
1 1 4
4 6 2
3 3 5
10 6 4
1 11 5

output:

8
2
4
10
4
8
6

result:

wrong answer 7th numbers differ - expected: '5', found: '6'