QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#728918#9381. 502 Bad Gatewaylylmeichichi#WA 111ms3688kbC++14787b2024-11-09 16:11:542024-11-09 16:11:55

Judging History

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

  • [2024-11-09 16:11:55]
  • 评测
  • 测评结果:WA
  • 用时:111ms
  • 内存:3688kb
  • [2024-11-09 16:11:54]
  • 提交

answer

//From: ifffer_2137
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf 0x7fffffff
#define eb emplace_back
#define pii pair<int,int>
#define mkpr make_pair
#define fir first
#define sec second
inline int read(){
	char ch=getchar();int x=0,w=1;
	while(ch<'0'||ch>'9'){if(ch=='-')w=-1;ch=getchar();}
	while(ch>='0'&&ch<='9')x=(x<<1)+(x<<3)+ch-48,ch=getchar();return w==1?x:-x;
}
const int maxn=2e5+5;
int _;
int T;
signed main(){
	#ifndef ONLINE_JUDGE
		assert(freopen("data.in","r",stdin));
		assert(freopen("test.out","w",stdout));
	#endif
	_=read();
	while(_--){
		T=read();
		int B=(T+3)/2;
		if(B*2<T+3) B++;
		B=min(B,T);
		int X=B*(B+1)+(T-B)*(B+3),Y=T*2;
		int g=__gcd(X,Y);
		cout<<X/g<<' '<<Y/g<<'\n';
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 111ms
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
125000000999999999 500000000
1 1
1 1
125000000999999999 500000000
1 1
125000000999999999 500000000
1 1
1 1
1 1
125000000999999999 500000000
1 1
1 1
125000000999999999 500000000
1 1
125000000999999999 500000000
125000000999999999 500000000
1 1
125000000999999999 500000000
1 1
1 1
1250000009999999...

result:

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