Submission #3106065


Source Code Expand

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

int n;
vector<int> c;
int memo[105] = {0};
int memo2[105] = {0};
double ans = 0;

long long mypow(long long x, long long y) {
  long long answer = 1;
  for(long long i = 0; i < y; ++i) ans *= x;
  return answer;
}
long long mycomb(long long nn, long long k) {
  long long answer = 1, i;
  for(i = 2; i <= nn; ++i) ans *= i;
  for(i = 2; i < k; ++i) ans /= i;
  for(i = 2; i < nn - k; ++i) ans /= i;
  return answer;
}

int main() {
  cout << fixed << setprecision(8);
  int i, j, x;
  cin >> n;
  for(i = 0; i < n; ++i) {
    cin >> x;
    c.push_back(x);
  }
  sort(c.begin(), c.end());
  for(i = 0; i < n; ++i)
    for(j = 0; j < n; ++j)
      if(c[j] % c[i] == 0 && c[j] >= c[i] && i != j)
        ++memo[j];
  for(i = 0; i < n; ++i) ++memo2[memo[i]];
  for(i = 0; i < n; ++i)
    ans += (double)memo2[i] * (double)((i + 2) / 2) /
           (double)(i + 1);

  cout << ans << endl;
  return 0;
}

Submission Info

Submission Time
Task C - コイン
User m_tsubasa
Language C++14 (GCC 5.4.1)
Score 100
Code Size 988 Byte
Status
Exec Time 2 ms
Memory 384 KB

Test Cases

Set Name Score / Max Score Test Cases
Sample 0 / 0 sample_01.txt, sample_02.txt, sample_03.txt
Subtask1 99 / 99 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt
Subtask2 1 / 1 subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt, subtask1_15.txt, subtask1_16.txt, subtask1_17.txt, subtask1_18.txt, subtask1_19.txt, subtask1_20.txt, subtask2_01.txt, subtask2_02.txt, subtask2_03.txt, subtask2_04.txt, subtask2_05.txt, subtask2_06.txt, subtask2_07.txt, subtask2_08.txt, subtask2_09.txt, subtask2_10.txt, subtask2_11.txt, subtask2_12.txt, subtask2_13.txt, subtask2_14.txt, subtask2_15.txt, subtask2_16.txt, subtask2_17.txt, subtask2_18.txt, subtask2_19.txt, subtask2_20.txt
Case Name Status Exec Time Memory
sample_01.txt 2 ms 384 KB
sample_02.txt 1 ms 256 KB
sample_03.txt 1 ms 256 KB
subtask1_01.txt 1 ms 256 KB
subtask1_02.txt 1 ms 256 KB
subtask1_03.txt 1 ms 256 KB
subtask1_04.txt 1 ms 256 KB
subtask1_05.txt 1 ms 256 KB
subtask1_06.txt 1 ms 256 KB
subtask1_07.txt 1 ms 256 KB
subtask1_08.txt 1 ms 256 KB
subtask1_09.txt 1 ms 256 KB
subtask1_10.txt 1 ms 256 KB
subtask1_11.txt 1 ms 256 KB
subtask1_12.txt 1 ms 256 KB
subtask1_13.txt 1 ms 256 KB
subtask1_14.txt 1 ms 256 KB
subtask1_15.txt 1 ms 256 KB
subtask1_16.txt 1 ms 256 KB
subtask1_17.txt 1 ms 256 KB
subtask1_18.txt 1 ms 256 KB
subtask1_19.txt 1 ms 256 KB
subtask1_20.txt 1 ms 256 KB
subtask2_01.txt 1 ms 256 KB
subtask2_02.txt 1 ms 256 KB
subtask2_03.txt 1 ms 256 KB
subtask2_04.txt 1 ms 256 KB
subtask2_05.txt 1 ms 256 KB
subtask2_06.txt 1 ms 256 KB
subtask2_07.txt 1 ms 256 KB
subtask2_08.txt 1 ms 256 KB
subtask2_09.txt 1 ms 256 KB
subtask2_10.txt 1 ms 256 KB
subtask2_11.txt 1 ms 256 KB
subtask2_12.txt 1 ms 256 KB
subtask2_13.txt 1 ms 256 KB
subtask2_14.txt 1 ms 256 KB
subtask2_15.txt 1 ms 256 KB
subtask2_16.txt 1 ms 256 KB
subtask2_17.txt 1 ms 256 KB
subtask2_18.txt 1 ms 256 KB
subtask2_19.txt 1 ms 256 KB
subtask2_20.txt 1 ms 256 KB