QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#587983#9381. 502 Bad GatewayroufuboWA 127ms3864kbC++14570b2024-09-24 23:17:042024-09-24 23:17:06

Judging History

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

  • [2024-09-24 23:17:06]
  • 评测
  • 测评结果:WA
  • 用时:127ms
  • 内存:3864kb
  • [2024-09-24 23:17:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
ll t;
ll gcd(ll a, ll b) {
	if (b == 0)return a;
	return gcd(b, a % b);
}
void solve() {
	scanf("%lld", &t);
	if (t == 1)printf("1 1\n");
	else if (t == 2)printf("3 2\n");
	else if (t == 3)printf("2 1\n");
	else {
		ll z = (t + 1) / 2 + 1;
		ll h = t - z;
		ll fz = (1 + z) * z / 2 + h;
		ll fm = t - h;
		ll gcds = gcd(fz, fm);
		fz /= gcds, fm /= gcds;
		printf("%lld %lld\n", fz, fm);
	}
}
int main() {
	int T;
	scanf("%d", &T);
	while (T--) {
		solve();
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 3796kb

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 127ms
memory: 3864kb

input:

1000000
1
1000000000
1
1
1000000000
1
1000000000
1
1
1
1000000000
1
1
1000000000
1
1000000000
1000000000
1
1000000000
1
1
1000000000
1
1000000000
1000000000
1
1000000000
1000000000
1000000000
1000000000
1000000000
1000000000
1
1
1000000000
1
1000000000
1000000000
1000000000
1000000000
1
1
1
10000000...

output:

1 1
125000001250000000 500000001
1 1
1 1
125000001250000000 500000001
1 1
125000001250000000 500000001
1 1
1 1
1 1
125000001250000000 500000001
1 1
1 1
125000001250000000 500000001
1 1
125000001250000000 500000001
125000001250000000 500000001
1 1
125000001250000000 500000001
1 1
1 1
1250000012500000...

result:

wrong answer 2nd lines differ - expected: '1999961560 44721', found: '125000001250000000 500000001'