QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#580385#9381. 502 Bad GatewayttyymmWA 359ms3760kbC++17403b2024-09-21 21:38:332024-09-21 21:38:34

Judging History

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

  • [2024-09-24 14:55:37]
  • hack成功,自动添加数据
  • (/hack/886)
  • [2024-09-21 21:38:34]
  • 评测
  • 测评结果:WA
  • 用时:359ms
  • 内存:3760kb
  • [2024-09-21 21:38:33]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,t;
signed main(){
	ios::sync_with_stdio(0);
	cin>>n;
	while(n--){
		cin>>t;
		int l=floor(sqrt(2*t)),r=ceil(sqrt(2*t)),s;
		long double ans1=(l*(l-1)+2*t)/2/l,ans2=(r*(r-1)+2*t)/2/r;
		ans1<ans2?s=l:s=r;
		int fz=s*(s-1)+2*t,fm=2*s;
		int p=__gcd(fz,fm);
		fz/=p,fm/=p;
		cout<<fz<<" "<<fm<<endl;
	}
	return 0;
}

詳細信息

Test #1:

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

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 359ms
memory: 3760kb

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'