QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#644391#9381. 502 Bad GatewayTheShuMo#WA 262ms3828kbC++141.0kb2024-10-16 13:41:412024-10-16 13:41:42

Judging History

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

  • [2024-10-16 13:41:42]
  • 评测
  • 测评结果:WA
  • 用时:262ms
  • 内存:3828kb
  • [2024-10-16 13:41:41]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define pb push_back
namespace IO {
    #define gh getchar
    inline int read(){char ch=gh();int x=0;bool t=0;while(ch<'0'||ch>'9')   t|=ch=='-',ch=gh();while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=gh();return t?-x:x;}
    inline char getc(){char ch=gh();while(ch<'a'||ch>'z') ch=gh();return ch;}
    inline void write(int x){if(x < 0){putchar('-');x = -x;}if(x > 9){write(x / 10);}putchar((x % 10 + '0'));}
}
using namespace IO;
using namespace std;
const int Maxn = 100010, mod = 1e8;

signed main(){
    int t = read();
    while(t--){
        int n = read();
        int n1 = ceil(sqrt(2.0 * n)), n2 = floor(sqrt(2.0 * n));
        int p1 = n1 * n1 + 2 * n - n1, z1 = 2 * 1 * n1;
        int p2 = n2 * n2 + 2 * n - n2, z2 = 2 * 1 * n2;
        if(p1 * z2 < p2 * z1){
            int g = __gcd(p1,z1);
            write(p1 / g); putchar(' '); write(z1 / g);
        }if(1){
            int g = __gcd(p2,z2);
            write(p2 / g); putchar(' '); write(z2 / g);
        }
        puts("");
    }
}

詳細信息

Test #1:

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

input:

3
1
2
3

output:

1 1
3 2
2 1

result:

ok 3 lines

Test #2:

score: 0
Accepted
time: 109ms
memory: 3776kb

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
1999961560 44721
1 1
1 1
1999961560 44721
1 1
1999961560 44721
1 1
1 1
1 1
1999961560 44721
1 1
1 1
1999961560 44721
1 1
1999961560 44721
1999961560 44721
1 1
1999961560 44721
1 1
1 1
1999961560 44721
1 1
1999961560 44721
1999961560 44721
1 1
1999961560 44721
1999961560 44721
1999961560 44721
19...

result:

ok 1000000 lines

Test #3:

score: -100
Wrong Answer
time: 262ms
memory: 3828kb

input:

1000000
158260522
877914575
602436426
24979445
861648772
623690081
433933447
476190629
262703497
211047202
971407775
628894325
731963982
822804784
450968417
430302156
982631932
161735902
880895728
923078537
707723857
189330739
910286918
802329211
404539679
303238506
317063340
492686568
773361868
125...

output:

316511467 17791
1755824328 41903877891213 20951
1204845831 34711
49954223 7068
1723292600 41513215406386 5189
623676492 17659
867864517 29460867835058 29459
952375859 30861952344999 30860
262700539 11461525378157 22921
422085442 20545211032449 10272
1942776701 44077
251551941 7093
1463896912 38261
1...

result:

wrong answer 2nd lines differ - expected: '1755824328 41903', found: '1755824328 41903877891213 20951'