QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#499400#6727. K-hour ClockssmyWA 281ms3648kbC++20566b2024-07-31 13:52:332024-07-31 13:52:34

Judging History

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

  • [2024-07-31 13:52:34]
  • 评测
  • 测评结果:WA
  • 用时:281ms
  • 内存:3648kb
  • [2024-07-31 13:52:33]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
	int x, y, z;
	std:: cin >> x >> y >> z;
	int t = x + y;
	if(t <= z)
	{
		std:: cout << -1 << endl;
		return ;
	}
	else
	{
		int ans = t - z;
		for(int i = 2;  i <= ans / i; i ++ )
		{
			if(ans % i == 0)
			{
				std:: cout << ans / i << endl;
				return ;
			}
		}
		std:: cout << t - z << endl;
	}
}   
signed main()
{
	ios::sync_with_stdio(false);
	cin.tie(0), cout.tie(0);
    int T;
    std:: cin >> T;
    while(T -- )
	solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

4
11 18 5
3 49 4
1 9 1
1 3 10

output:

12
24
3
-1

result:

ok 4 cases

Test #2:

score: -100
Wrong Answer
time: 281ms
memory: 3648kb

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:

366630998
295766459
-1
325038031
11798701
-1
552874798
199326352
213236379
601592069
63522511
1057591501
-1
282655327
-1
16811
-1
614781068
398961578
116662532
-1
-1
182796205
173773429
-1
-1
58488467
-1
526653460
124120603
-1
-1
-1
-1
14508433
14213341
-1
-1
213109970
-1
-1
66560403
120529379
72546...

result:

wrong answer Case #2: k <= x (x = 409013320, y = 825277663, z = 642758065, k = 295766459)