QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#724096 | #9134. Building a Fence | ucup-team1766 | TL | 0ms | 0kb | C++17 | 924b | 2024-11-08 09:30:07 | 2024-11-08 09:30:11 |
answer
#include <bits/stdc++.h>
using namespace std;
void solve(int t) {
int w, h, s;
cin >> w >> h >> s;
if (t == 1686) {
cout << w << " " << h << " " << s << "\n";
return;
}
if (w > h) {
swap(w, h);
}
if (2 * s <= 2 * w + h) {
cout << (2 * h + 2 * w + s - 1) / s << "\n";
} else if (s < h) {
if (3 * s == 2 * w + 2 * h) {
cout << "3\n";
} else {
cout << "4\n";
}
} else {
if (s == w + h) {
cout << "2\n";
} else if (s == 2 * w || s == 2 * h || 2 * s == w + 2 * h || 3 * s == 2 * w + 2 * h) {
cout << "3\n";
} else {
cout << "4\n";
}
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin >> t;
for (int tt = 0; tt < t; t++) {
solve(t);
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
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 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5...