QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#711443#8511. Greek CasinoAngelOlanWA 0ms4044kbC++20732b2024-11-05 11:04:132024-11-05 11:04:14

Judging History

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

  • [2024-11-05 11:04:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4044kb
  • [2024-11-05 11:04:13]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
// Pura Gente del Coach Moy
using ld = long double;
signed main() {
  cin.tie(0)->sync_with_stdio(0);
  cout << setprecision(12) << fixed;

  int N;
  cin >> N;
  vector<int> W(N + 1);
  int S = 0;
  for (int i = 1; i <= N; ++i) {
    cin >> W[i];
    S += W[i];
  }

  vector<int> D(N + 1);
  for (int i = 1; i <= N; ++i) {
    for (int j = i; j <= N; j += i) {
      D[j] += W[i];
    }
  }

  vector<ld> E(N + 1);
  for (int i = N; i >= 1; --i) {
    ld C = (ld)D[i] / S, inner = C;
    for (int j = 2 * i; j <= N; j += i) {
      inner += (1 + E[j]) * (D[j] - D[i]) / S;
    }
    E[i] = inner / (1 - C);
  }
  cout << E[1] << '\n';

  return 0;
}

詳細信息

Test #1:

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

input:

3
1 1 1

output:

3.500000000000

result:

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

Test #2:

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

input:

3
1 1 2

output:

3.666666666667

result:

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

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 4044kb

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:

6.540367357148

result:

wrong answer 1st numbers differ - expected: '1.0183368', found: '6.5403674', error = '5.4225973'