QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#583875#9381. 502 Bad GatewayD06WA 148ms3656kbC++14460b2024-09-22 23:24:202024-09-22 23:24:20

Judging History

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

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

answer

#include <bits/stdc++.h>
using namespace std;
int t;
bool cmp(int n1,int n2)
{
	return (n1>n2)^(n1*n2>2*t);
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>t;
		int l=sqrt(t),r=ceil(sqrt(t));
		int id;
		if(cmp(l,r))
		{
			id=l;
		}
		else
		{
			id=r;
		}
		int x=id*(id+1)/2+t-id,y=id;
		int g=__gcd(x,y);
		x/=g;
		y/=g;
		cout<<x<<' '<<y<<"\n";
	}
	return 0;
}

详细

Test #1:

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

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 148ms
memory: 3656kb

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
1499991253 31623
1 1
1 1
1499991253 31623
1 1
1499991253 31623
1 1
1 1
1 1
1499991253 31623
1 1
1 1
1499991253 31623
1 1
1499991253 31623
1499991253 31623
1 1
1499991253 31623
1 1
1 1
1499991253 31623
1 1
1499991253 31623
1499991253 31623
1 1
1499991253 31623
1499991253 31623
1499991253 31623
14...

result:

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