QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#499452#6727. K-hour ClockpagohiaWA 36ms3664kbC++141015b2024-07-31 14:24:432024-07-31 14:24:53

Judging History

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

  • [2024-07-31 14:24:53]
  • 评测
  • 测评结果:WA
  • 用时:36ms
  • 内存:3664kb
  • [2024-07-31 14:24:43]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;

const int N = 2e9;
const int M = 5e4 + 10;
typedef long long ll;
typedef double db;
typedef pair<int, int>pii;
typedef pair<long, long>pll;
int dx[4] = { 0, 1, 0, -1 }, dy[4] = { 1, 0, -1, 0 };

inline long long read()
{
	long long w = 1;
	long long q = 0;
	char ch = ' ';
	while (ch != '-' && (ch < '0' || ch>'9')) ch = getchar();
	if (ch == '-') w = -1, ch = getchar();
	while (ch >= '0' && ch <= '9')
		q = q * 10 + ch - '0', ch = getchar();
	return w * q;
}
void solve()
{
	long long x, y, z;
	cin >> x >> y >> z;
	long long sum = x+y-z;
	
	if (sum == 0)
	{
		cout << z + 1;
		return;
	}
	else if (sum < z)
	{
		
		cout << -1<< endl;
		return;
	}
	else if (sum < 0)
	{
		
		cout << -1 << endl;
		return;

	}
	
	else
	{
		cout << sum << endl;
		return;
	}
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	cout.tie(0);
	int tcase = 1;
	cin >> tcase;
	while (tcase--)
		solve();
	return 0;

}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3664kb

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: -100
Wrong Answer
time: 36ms
memory: 3652kb

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
253845964975114093
-1
5299267251105749596
-1
639709137
1203184138
-1
1057591501
673441983847965981
-1
-1
6435435231229562136
797923156
-1
488183711524483170913981025
-1
611749282-1
1345234741
8629565241053306920
-1
-1
410033100-1
808528037-1
326906843
970821147433733581-1
644562937-1
-1...

result:

wrong output format Expected int32, but "253845964975114093" found