QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#583835#9381. 502 Bad GatewayhuangceWA 145ms3672kbC++17593b2024-09-22 23:00:162024-09-22 23:00:17

Judging History

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

  • [2024-09-24 14:55:37]
  • hack成功,自动添加数据
  • (/hack/886)
  • [2024-09-22 23:00:17]
  • 评测
  • 测评结果:WA
  • 用时:145ms
  • 内存:3672kb
  • [2024-09-22 23:00:16]
  • 提交

answer

#include<bits/stdc++.h>
#define endl '\n'
#define ll long long
#define int ll
using namespace std;
constexpr int N=1e6+7;
constexpr int M=2e3+7;
int t;
void solve()
{
	cin>>t;
	int c=sqrt(2*t);
	if(c*c==2*t)
	{
		int fenzi=c*c-c+2*t;
		int fenmu=2*c;
		int tt=__gcd(fenzi,fenmu);
		cout<<fenzi/tt<<' '<<fenmu/tt<<endl;
		return;
	}
	c++;
	int fenzi=c*c-c+2*t;
	int fenmu=2*c;
	int tt=__gcd(fenzi,fenmu);
	cout<<fenzi/tt<<' '<<fenmu/tt<<endl;
}
signed main()
{
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	int T=1; cin>>T;
	while(T--){solve();}
	return 0;
}

详细

Test #1:

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

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 145ms
memory: 3672kb

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
2000006281 44722
1 1
1 1
2000006281 44722
1 1
2000006281 44722
1 1
1 1
1 1
2000006281 44722
1 1
1 1
2000006281 44722
1 1
2000006281 44722
2000006281 44722
1 1
2000006281 44722
1 1
1 1
2000006281 44722
1 1
2000006281 44722
2000006281 44722
1 1
2000006281 44722
2000006281 44722
2000006281 44722
20...

result:

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