QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#583178#9381. 502 Bad GatewayslmhhWA 134ms3740kbC++23577b2024-09-22 18:47:112024-09-22 18:47:11

Judging History

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

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

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PII;
const int N = 2e5;

int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    int T;
    cin >> T;
    while(T--){
        ll n;
        cin >> n;
        double t = sqrt(8 * n + 1);
        ll a = -1 + (ll)t,b = -1 + ceil(t);
        ll ta = 2,tb = 2;
        if(a % 2 == 0) a /= 2,ta = 1;
        if(b % 2 == 0) b /= 2,tb = 1;
        if(a * tb > b * ta) cout << b << " " << tb << "\n";
        else cout << a << " " << ta << "\n"; 
    }
    return 0;
}

详细

Test #1:

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

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: -100
Wrong Answer
time: 134ms
memory: 3528kb

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
89441 2
1 1
1 1
89441 2
1 1
89441 2
1 1
1 1
1 1
89441 2
1 1
1 1
89441 2
1 1
89441 2
89441 2
1 1
89441 2
1 1
1 1
89441 2
1 1
89441 2
89441 2
1 1
89441 2
89441 2
89441 2
89441 2
89441 2
89441 2
1 1
1 1
89441 2
1 1
89441 2
89441 2
89441 2
89441 2
1 1
1 1
1 1
89441 2
89441 2
89441 2
1 1
89441 2
1 1
...

result:

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