QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#586984#9381. 502 Bad GatewayeweweWA 352ms3636kbC++14596b2024-09-24 16:55:212024-09-24 16:55:22

Judging History

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

  • [2024-09-24 16:55:22]
  • 评测
  • 测评结果:WA
  • 用时:352ms
  • 内存:3636kb
  • [2024-09-24 16:55:21]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

long long gcd(long long x,long long y)
{
	if (x<y)
	swap(x,y);
	if (y==0)
	return x;
	else
	return gcd(y,x%y);
}

void solve()
{
	long long T;
	cin>>T;
	if (T%2==1)
	{
		long long x=T*T+8*T-1;
		long long y=4*T+4;
		long long g=gcd(x,y);
		cout<<x/g<<" "<<y/g<<endl;
	}
	else
	{
		long long x=T*T+10*T;
		long long y=4*T+8;
		long long g=gcd(x,y);
		cout<<x/g<<" "<<y/g<<endl;
	}
}

signed main()
{
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int tt;
	cin>>tt;
	while(tt--)
	solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 352ms
memory: 3572kb

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'