QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#362111#8511. Greek Casinoucup-team2303#WA 1ms5856kbC++201.2kb2024-03-23 14:11:502024-03-23 14:11:51

Judging History

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

  • [2024-03-23 14:11:51]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5856kb
  • [2024-03-23 14:11:50]
  • 提交

answer

// #pragma GCC optimize("Ofast")
// #pragma GCC optimize("unroll-loops")
// #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2")
#include <bits/stdc++.h>
#define int long long
#define i64 long long
#define pii pair <int, int> 
using namespace std;
inline int read(void) {
    int x=0,sgn=1; char ch=getchar();
    while(ch<48||57<ch) {if(ch==45)sgn=0;ch=getchar();}
    while(47<ch&&ch<58) {x=x*10+ch-48;   ch=getchar();}
    return sgn? x:-x;
}
void write(int x) {
    if(x<0) putchar('-'),x=-x;
    if(x>9) write(x/10);
    putchar(x%10+'0');
}
/*
    write((Ans%p+p)%p); pls
*/
#define double long double
int n,sum;
int v[100005];
double r[100005];
double Ans;
signed main() {
    // freopen("localinput","r",stdin);
    // freopen("localoutput","w",stdout);
    n=read();
    for(int i=1; i<=n; ++i) sum+=(v[i]=read());
    for(int i=1; i<=n; ++i)
        for(int u=i<<1; u<=n; u+=i) 
            v[u]+=v[i];
    for(int i=1; i<=n; ++i) r[i]=1.0*sum/(sum-v[i]);
    for(int i=1; i<=n; ++i)
        for(int u=i<<1; u<=n; u+=i) 
            r[u]-=r[i];
    for(int i=1; i<=n; ++i) Ans+=r[i];
    printf("%.10Lf\n",Ans-1.0);
    // fprintf(stderr,"%.4lf\n",1.0*clock()/CLOCKS_PER_SEC);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 1 1

output:

3.5000000000

result:

ok found '3.500000000', expected '3.500000000', error '0.000000000'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3976kb

input:

3
1 1 2

output:

3.6666666667

result:

ok found '3.666666667', expected '3.666666667', error '0.000000000'

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 5856kb

input:

1337
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1...

output:

39.2851060076

result:

wrong answer 1st numbers differ - expected: '1.0183368', found: '39.2851060', error = '37.5777131'