QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#692914 | #6727. K-hour Clock | Shuishui# | AC ✓ | 24ms | 3780kb | C++14 | 946b | 2024-10-31 15:13:00 | 2024-10-31 15:13:02 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define fi first
#define se second
#define all(x) (x).begin(), (x).end()
#define Sz(x) (int)(x).size()
#define bit(x) (1ll << (x))
using ll = long long;
using db = double;
using ull = unsigned long long;
using pii = pair<int, int>;
using vi = vector<int>;
using vii = vector<vi>;
using vl = vector<ll>;
using vll = vector<vl>;
using vs = vector<string>;
using vd = vector<db>;
mt19937 mrand(time(0));
void solve(void)
{
int x, y, z;
cin >> x >> y >> z;
if (x + y < z) cout << -1 << "\n";
else if (x + y == z) cout << z + 1 << "\n";
else
{
int k = x + y - z;
if (k <= max({x, z}))
cout << -1 << "\n";
else
cout << k << "\n";
}
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
// cout << fixed << setprecision(10);
int T = 1;
cin >> T;
for (int i = 1; i <= T; i++)
solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3692kb
input:
4 11 18 5 3 49 4 1 9 1 1 3 10
output:
24 48 9 -1
result:
ok 4 cases
Test #2:
score: 0
Accepted
time: 24ms
memory: 3780kb
input:
100000 186826504 580942638 34507146 409013320 825277663 642758065 221040339 32805624 253845963 759538401 529610463 314034771 591738614 223935926 591499221 272890462 257036262 529926724 644722795 540369561 79342760 141738127 915104743 658190166 378771709 735410115 474472687 550207480 676282297 233056...
output:
733261996 -1 253845964 975114093 -1 529926725 1105749596 -1 639709137 1203184138 -1 1057591501 673441983 847965981 -1 -1 643543523 1229562136 797923156 -1 488183711 524483170 913981025 -1 611749282 -1 1345234741 862956524 1053306920 -1 -1 410033100 -1 808528037 -1 326906843 970821147 433733581 -1 64...
result:
ok 100000 cases