QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#62353#4602. Stormwindqinjianbin#AC ✓21ms3476kbC++17500b2022-11-18 12:49:072022-11-18 12:49:10

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-18 12:49:10]
  • 评测
  • 测评结果:AC
  • 用时:21ms
  • 内存:3476kb
  • [2022-11-18 12:49:07]
  • 提交

answer

#include<bits/stdc++.h>
#define rep(i, a, b) for(int i = (a); i < (b); i++)
#define _for(i, a, b) for(int i = (a); i <= (b); i++)
using namespace std;

typedef long long ll;

int main()
{
	int T; scanf("%d", &T);
	while(T--)
	{
		ll n, m, k;
		scanf("%lld%lld%lld", &n, &m, &k);

		ll ans = 0;
		_for(x, 1, n)
		{
			ll t = n / x;
			ll p = (k + t - 1) / t;
			ll y = m / p;
			if(1 <= y && y <= m) ans = max(ans, x + y - 2); 
		}
		printf("%lld\n", ans);
	}
	
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 21ms
memory: 3476kb

input:

100
4512 280 84534
5696 5722 24210
9479 4059 26673
2586 8773 48314
8276 8914 21669
7881 3626 21364
847 799 41930
9150 9736 35438
9717 9840 30434
9863 4670 5185
883 299 11160
9242 2987 58772
6320 4154 48160
3769 7659 28041
3800 1368 59568
2424 1711 76469
8361 7862 26295
376 5567 79535
1509 7487 77865...

output:

13
1143
1353
460
2970
1312
14
2433
2459
4930
22
461
525
956
85
52
2089
25
142
97
987
1756
956
526
8602
25
2260
4
489
366
276
36
1295
2576
420
733
1615
1104
761
40
905
729
825
944
1469
460
865
102
2772
251
741
7021
718
175
1105
566
1263
1273
151
4381
2897
172
203
367
1522
753
1032
30
972
8716
143
154...

result:

ok 100 lines