QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#588000#9381. 502 Bad GatewayroufuboWA 118ms3808kbC++14567b2024-09-24 23:26:052024-09-24 23:26:06

Judging History

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

  • [2024-09-24 23:26:06]
  • 评测
  • 测评结果:WA
  • 用时:118ms
  • 内存:3808kb
  • [2024-09-24 23:26:05]
  • 提交

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 ;
		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: 0ms
memory: 3768kb

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 118ms
memory: 3808kb

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
500000003 2
1 1
1 1
500000003 2
1 1
500000003 2
1 1
1 1
1 1
500000003 2
1 1
1 1
500000003 2
1 1
500000003 2
500000003 2
1 1
500000003 2
1 1
1 1
500000003 2
1 1
500000003 2
500000003 2
1 1
500000003 2
500000003 2
500000003 2
500000003 2
500000003 2
500000003 2
1 1
1 1
500000003 2
1 1
500000003 2
...

result:

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