QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#607496#9355. Keeping Rabbitscatwine#AC ✓413ms5064kbC++14734b2024-10-03 15:03:552024-10-03 15:03:57

Judging History

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

  • [2024-10-03 15:03:57]
  • 评测
  • 测评结果:AC
  • 用时:413ms
  • 内存:5064kb
  • [2024-10-03 15:03:55]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

#define int long long
#define endl '\n'

#ifdef DEBUG
#define debug(x) cerr << #x << ": " << x << endl;
#else
#define debug(x)
#endif

int n, m, t;

void solve() {
  cin >> n >> m;
  vector<double> a(n), b(n);
  double sum = 0;
  for (double &it : a) {
    cin >> it;
    sum += it;
  }
  for (int i = 0; i < n; ++i) {
    b[i] = a[i] / sum;
  }
  for (int i = 0; i < n; ++i) {
    a[i] += b[i] * m;
  }
  for (int i = 0; i < n; ++i) {
    cout << fixed << setprecision(16) << a[i] << ' ';
  }
  cout << endl;
}

signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0), cout.tie(0), cerr.tie(0);

  cin >> t;
  while (t--)
    solve();
}


这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3
1 1
2
2 2
1 3
3 2
1 1 1

output:

3.0000000000000000 
1.5000000000000000 4.5000000000000000 
1.6666666666666665 1.6666666666666665 1.6666666666666665 

result:

ok 6 numbers

Test #2:

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

input:

10
10 5
6 9 4 4 4 7 6 2 8 7
10 3
9 4 10 4 2 8 8 6 4 7
10 2
2 5 9 4 9 4 2 7 5 9
10 5
9 1 2 1 10 10 7 9 7 1
10 6
8 3 1 10 5 3 1 6 3 10
10 10
5 9 1 7 10 7 6 6 4 4
10 6
1 7 9 5 1 1 6 3 6 5
10 7
5 6 9 1 9 7 1 1 4 5
10 3
4 10 3 3 10 9 3 6 9 10
10 6
5 5 1 2 4 6 8 1 8 2

output:

6.5263157894736841 9.7894736842105257 4.3508771929824563 4.3508771929824563 4.3508771929824563 7.6140350877192979 6.5263157894736841 2.1754385964912282 8.7017543859649127 7.6140350877192979 
9.4354838709677420 4.1935483870967740 10.4838709677419359 4.1935483870967740 2.0967741935483870 8.38709677419...

result:

ok 100 numbers

Test #3:

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

input:

10
10 2
18 23 74 43 31 61 59 9 82 39
10 6
82 44 26 99 29 100 24 45 14 8
10 3
10 76 15 14 73 94 48 83 84 20
10 1
35 20 48 6 17 75 57 78 76 39
10 9
13 92 32 23 32 93 13 38 34 64
10 9
45 41 26 90 96 9 20 37 93 14
10 9
81 3 56 89 58 30 21 2 93 28
10 4
69 4 11 77 81 24 19 70 4 85
10 8
5 39 89 36 82 37 12...

output:

18.0820045558086555 23.1047835990888366 74.3371298405466945 43.1958997722095646 31.1412300683371299 61.2779043280182236 59.2687927107061512 9.0410022779043278 82.3735763097949842 39.1776765375854197 
83.0445859872611436 44.5605095541401255 26.3312101910828034 100.2611464968152859 29.3694267515923570...

result:

ok 100 numbers

Test #4:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

10
100 28
54 29 35 99 52 7 52 91 49 4 71 33 22 90 11 73 28 13 43 64 26 47 53 56 32 76 40 80 90 84 18 90 24 96 81 66 82 21 75 58 46 52 45 38 36 82 66 33 4 54 2 57 43 9 64 43 72 10 1 31 80 89 49 100 35 61 44 45 51 51 39 80 80 11 31 95 65 59 81 43 81 2 46 60 90 65 83 55 52 93 80 66 61 29 23 99 2 64 22 ...

output:

54.2882195958825804 29.1547845977887903 35.1868089973312976 99.5284025924513855 52.2775447960350732 7.0373617994662601 52.2775447960350732 91.4857033930613852 49.2615325962638195 4.0213495996950055 71.3789553945863560 33.1761341974837975 22.1174227983225329 90.4803659931376245 11.0587113991612664 73...

result:

ok 1000 numbers

Test #5:

score: 0
Accepted
time: 413ms
memory: 5064kb

input:

1005
89 48
24 95 46 14 50 35 66 24 31 84 66 39 16 80 14 78 49 46 8 19 2 33 97 37 40 85 13 19 51 58 24 87 87 69 77 62 65 5 10 5 15 75 12 32 35 24 13 90 64 89 71 22 94 31 70 93 38 89 56 26 78 56 74 32 28 52 35 61 87 17 1 54 2 88 62 34 74 27 47 18 12 57 88 39 37 76 36 24 31
89 70
71 4 27 56 36 65 33 6 ...

output:

24.2758620689655160 96.0919540229885030 46.5287356321839098 14.1609195402298855 50.5747126436781613 35.4022988505747094 66.7586206896551744 24.2758620689655160 31.3563218390804614 84.9655172413793167 66.7586206896551744 39.4482758620689680 16.1839080459770130 80.9195402298850581 14.1609195402298855 ...

result:

ok 589000 numbers

Extra Test:

score: 0
Extra Test Passed