Problem:
Score : 100 points

Problem Statement

Given is an integer N.

Takahashi chooses an integer a from the positive integers not greater than N with equal probability.

Find the probability that a is odd.

Constraints

1 \leq N \leq 100

Input

Input is given from Standard Input in the following format:

N

Output

Print the probability that a is odd.
Your output will be considered correct when its absolute or relative error from the judge's output is at most 10^{-6}.

Sample Input 1

4

Sample Output 1

0.5000000000

There are four positive integers not greater than 4: 1, 2, 3, and 4. Among them, we have two odd numbers: 1 and 3. Thus, the answer is \frac{2}{4} = 0.5.

Sample Input 2

5

Sample Output 2

0.6000000000

Sample Input 3

1

Sample Output 3

1.0000000000

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

// This file is a "Hello, world!" in C++ language by GCC for wandbox.
#include <iostream>
#include <cstdlib>
#include<regex>
#include<vector>
#include<algorithm>
using namespace std;

struct person
{
    int id;
    int num;
};

vector< int64_t > divisors(int64_t n) {
    vector< int64_t > ret;
    vector<int64_t> ret2;
    if (n % 2 == 0) ret.push_back(2);
    for(int64_t i = 3; i * i <= n; i+=2) {
        if(n % i == 0) 
        {
            ret.push_back(i);
            if(i * i != n) ret.push_back(n / i);
        }
    }
        
    sort(begin(ret), end(ret));
    for(auto i : ret)
    {
        bool need = true;
        for(auto j : ret2)
        {
            if(i % j == 0) need = false;
        }
        if(need) ret2.push_back(i);
    }
    
    ret2.push_back(1);
    sort(begin(ret2), end(ret2));
    return (ret2);
}

vector< int64_t > divisor(int64_t n) {
  vector< int64_t > ret;
  for(int64_t i = 1; i * i <= n; i++) {
    if(n % i == 0) {
      ret.push_back(i);
      if(i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}

vector<int64_t> prime(vector<int64_t> v)
{
    vector<int64_t> ret{1};
    for(auto one : v)
    {
        bool notNeed = false;
        //cout << "one:" << one << " ";
        
        if(one == 1) continue;
        for(auto j : ret)
        {
            if(j == 1) continue;
            if(one % j == 0) notNeed = true;
        }
        if(!notNeed)
        {
            ret.push_back(one);
            //cout << "add: " << one << endl;
        }
    }
    
    return ret;
}

int main()
{   
    int64_t num1, num2;
    cin >> num1 >> num2;
    
    auto vNum1 = divisor(num1);
    vNum1 = prime(vNum1);
    
    //for(auto one : vNum1)
    //{
    //    cout << one << " ";
    //}
    
    int ret = 0;
    for(auto one : vNum1)
    {
        if(num2 % one == 0) ret++;
        //if(num2 % one == 0) cout << one << " ";
    }
   
    cout << ret;
    return 0;
}