QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#408153#6889. PSOxuzhihaodedie#AC ✓55ms3788kbC++20758b2024-05-09 19:04:282024-05-09 19:04:42

Judging History

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

  • [2024-05-09 19:04:42]
  • 评测
  • 测评结果:AC
  • 用时:55ms
  • 内存:3788kb
  • [2024-05-09 19:04:28]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define int long long
#define PII pair<int,int>
#define lson 2*p
#define rson 2*p+1
#define x first
#define y second
//#define endl "\n"
constexpr int N=1e6+10;
constexpr int mod=998244353;
int b[N],a[N];
struct node {
    int a,b;
} f[N];
bool cmp(node a,node b) {
    return a.a+a.b>b.a+b.b;
}
void solve() {
    int n;
    cin>>n;
    if(n==2) {
        double ret=1;
        printf("%.9lf %.9lf\n",ret,ret);
        return ;
    }
    double ans=n-1+(n-1)*(n-2);
    double res=n*(n-1)/2;
    printf("%.9lf 2.000000000\n",ans/res);
}
signed main() {
    // ios::sync_with_stdio(false);
    // cin.tie(0);
    int T=1;
    cin>>T;
    while(T--) {
        solve();
    }
}

详细

Test #1:

score: 100
Accepted
time: 55ms
memory: 3788kb

input:

100000
1000000000
316282544
8750007
736358249
599449905
958797884
57807155
190721739
49078691
54519372
197507191
189770390
669595503
625443707
681627652
859163225
633903516
942163948
162318847
907559014
367667214
702553026
250779315
583592021
539773972
398355366
716540172
8874879
281470171
909896004...

output:

1.999999998 2.000000000
1.999999994 2.000000000
1.999999771 2.000000000
1.999999997 2.000000000
1.999999997 2.000000000
1.999999998 2.000000000
1.999999965 2.000000000
1.999999990 2.000000000
1.999999959 2.000000000
1.999999963 2.000000000
1.999999990 2.000000000
1.999999989 2.000000000
1.999999997 ...

result:

ok 100000 lines