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 JavaScript (node.js v5.12) (judge verdict: Accepted)

!function(e){var t={};function n(r){if(t[r])return t[r].exports;var u=t[r]={i:r,l:!1,exports:{}};return e[r].call(u.exports,u,u.exports,n),u.l=!0,u.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var u in e)n.d(r,u,function(t){return e[t]}.bind(null,u));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},u=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var n in e)Object.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t.default=e,t};Object.defineProperty(t,"__esModule",{value:!0});var i=r(n(25)),o=u(n(26));t.paizaInput=function(){process.stdin.resume(),process.stdin.setEncoding("utf8");var e=[],t=o.createInterface({input:process.stdin,output:process.stdout});return t.on("line",function(t){e.push(t)}),new Promise(function(n){t.on("close",function(){n(e)})})},t.hackerRankInput=function(){process.stdin.resume(),process.stdin.setEncoding("ascii");var e="";return process.stdin.on("data",function(t){e+=t}),new Promise(function(t){process.stdin.on("end",function(){t(e.split("\n"))})})},t.atcoderInput=function(){return i.default.readFileSync("/dev/stdin","utf8")}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(u,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?u(e.value):new n(function(t){t(e.value)}).then(o,a)}c((r=r.apply(e,t||[])).next())})},u=this&&this.__generator||function(e,t){var n,r,u,i,o={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(u=2&i[0]?r.return:i[0]?r.throw||((u=r.return)&&u.call(r),0):r.next)&&!(u=u.call(r,i[1])).done)return u;switch(r=0,u&&(i=[2&i[0],u.value]),i[0]){case 0:case 1:u=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(u=(u=o.trys).length>0&&u[u.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!u||i[1]>u[0]&&i[1]<u[3])){o.label=i[1];break}if(6===i[0]&&o.label<u[1]){o.label=u[1],u=i;break}if(u&&o.label<u[2]){o.label=u[2],o.ops.push(i);break}u[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=u=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}},i=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var o=i(n(2)),a=n(0);!function(){r(this,void 0,void 0,function(){var e;return u(this,function(t){switch(t.label){case 0:return[4,a.paizaInput()];case 1:return e=t.sent(),o.default.beginner_contest_142.a(e).forEach(function(e){return console.log(e)}),[2]}})})}()},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=r(n(3)),i=r(n(7)),o=r(n(10)),a=r(n(14)),c=r(n(16)),f=r(n(19)),l=r(n(22)),s=r(n(24)),d=r(n(27));t.default={beginner_contest_122:u.default,beginner_contest_126:i.default,beginner_contest_133:o.default,beginner_contest_142:a.default,Diverta2019ProgrammingContest:c.default,GrandContest029:f.default,GrandContest035:l.default,interactiveSorting:s.default,welcomeToAtCoder:d.default}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=r(n(4)),i=r(n(5)),o=r(n(6));t.default={A_DoubleHelix:u.default,B_ATCoder:i.default,C_GeT_AC:o.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){switch(e[0]){case"A":return["T"];case"T":return["A"];case"C":return["G"];case"G":return["C"];default:throw new Error("invalid string")}}},function(e,t,n){"use strict";function r(e){return"A"===e||"T"===e||"C"===e||"G"===e}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){for(var t=e[0],n=0,u=0,i=0;u<t.length;u+=1)r(t[u])?i+=1:i>n&&(n=i,i=0);return i>n&&(n=i),[String(n)]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e[0].split(" ").map(function(e){return Number(e)}),n=(t[0],t[1],e[1]),r=e.slice(2).map(function(e){return e.split(" ").map(function(e){return Number(e)})}),u=n.split("").map(function(e,t,n){return"A"===e&&n.length>t+1&&"C"===n[t+1]});return r.map(function(e){for(var t=e[0],n=e[1],r=0,i=t-1;i<n-1;i+=1)u[i]&&(r+=1);return String(r)})}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=r(n(8)),i=r(n(9));t.default={a:u.default,b:i.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e[0].split(" ").map(function(e){return Number(e)}),n=(t[0],t[1]);return[e[1].split("").map(function(e,t){return t===n-1?e.toLowerCase():e}).join("")]}},function(e,t,n){"use strict";function r(e){return 1<=e&&e<=12}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=e[0],n=Number(t.slice(0,2)),u=Number(t.slice(2,4)),i=r(n),o=r(u);return i&&o?["AMBIGUOUS"]:!i&&o?["YYMM"]:i&&!o?["MMYY"]:["NA"]}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=r(n(11)),i=r(n(12)),o=r(n(13));t.default={b:u.default,c:i.default,d:o.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=function(e){return e.reduce(function(e,t,n,r){return e+t})};t.default=function(e){for(var t=e[0].split(" ").map(function(e){return Number(e)}),n=(t[0],t[1],e.slice(1).map(function(e){return e.split(" ").map(function(e){return Number(e)})})),u=0,i=0;i<n.length;i+=1)for(var o=function(e){var t,o=n[i],a=n[e];t=Math.sqrt(r(o.map(function(e,t){return Math.pow(e-a[t],2)}))),Math.round(t)===t&&(u+=1)},a=i+1;a<n.length;a+=1)o(a);return[u.toString()]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t,n,r=e[0].split(" ").map(function(e){return Number(e)}),u=r[0],i=r[1];Math.ceil(u/2019)===Math.ceil(i/2019)?(t=u%2019,n=i%2019):(t=u%2019,n=i%2019+2019);for(var o=2019,a=t;a<=n;a+=1)for(var c=a+1;c<=n;c+=1){var f=a*c%2019;f<o&&(o=f)}return[o.toString()]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){Number(e[0]);for(var t=e[1].split(" ").map(function(e){return Number(e)}),n=0;n<=2*t[0];n+=2){for(var r=n,u=void 0,i=!0,o=[],a=0;a<t.length;a+=1){if((u=t[a]-r)<0){i=!1;break}o.push(r),r=u}if(i&&2*t[t.length-1]===o[0]+o[o.length-1])return[o.map(function(e){return e.toString()}).join(" ")]}return[]}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=r(n(15));t.default={a:u.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=Number(e[0]),n=Math.floor(t/2)+(t%2==1?1:0);return[String(n/t)]}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=r(n(17)),i=r(n(18));t.default={c:u.default,d:i.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e[0].split(" ").map(function(e){return Number(e)})[0];var t=e.slice(1),n=0,r=0,u=0,i=0;return t.forEach(function(e,t){"B"===e[0]&&(u+=1),"A"===e[e.length-1]&&(r+=1),"B"===e[0]&&"A"===e[e.length-1]&&(i+=1),n+=(e.match(/AB/g)||[]).length}),r-i==0&&u-i==0?[String(n+i-1)]:[String(r<u?r+n:u+n)]}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){for(var t=e[0].split(" ").map(function(e){return Number(e)})[0],n=0,r=Math.sqrt(t),u=1;u<r;u+=1){var i=(t-u)/u;Number.isInteger(i)&&(n+=i)}return[String(n)]}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=r(n(20)),i=r(n(21));t.default={AIrreversibleOperation:u.default,BPowerOfTwo:i.default}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=!0,u=!1;function i(e){var t=function(e){for(var t=[],n=0;n<e.length-1;n+=1)e[n]===r&&e[n+1]===u&&t.push(n);return t}(e);return 0===t.length?0:1+Math.max.apply(Math,t.map(function(t){return i(function(e,t){var n=e.concat();return n[t]=!n[t],n[t+1]=!n[t+1],n}(e,t))}))}t.default=function(e){return[i(e[0].split("").map(function(e){return"B"===e}))]}},function(e,t,n){"use strict";function r(e){return e.length<2?0:Math.max.apply(Math,e.map(function(t,n){var u=e.filter(function(e,t){return t!==n});return Math.max.apply(Math,u.map(function(e,n){return function(e,t){var n=e+t;return 0==(n&n-1)}(t,e)?r(u.filter(function(e,t){return t!==n}))+1:0}))}))}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){Number(e[0]);var t=function(e){var t=e.filter(function(e){return e%2==1}),n=e.filter(function(e){return e%2==0});return{odds:t,evens:n}}(e[1].split(" ").map(function(e){return Number(e)})),n=t.odds,u=t.evens;return[r(n)+r(u)]}},function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});var u=r(n(23));t.default={a:u.default}},function(e,t,n){"use strict";function r(e,t,n){return(e^t)===n}Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){e[0].split(" ").map(function(e){return Number(e)})[0];var t=e[1].split(" ").map(function(e){return Number(e)});return[function e(t,n){if(0===n.length){var u=t.length;return r(t[u-2],t[0],t[u-1])&&r(t[u-1],t[1],t[0])?{array:t,ok:!0}:{array:[],ok:!1}}for(var i=0;i<n.length;i+=1){var o=n[i],a=t[t.length-1];if(t.length<2){var c=t.map(function(e){return e});c.push(o);var f=n.map(function(e){return e});f.splice(i,1);var l=e(c,f);if(l.ok)return l}else{var s=t[t.length-2];if(r(o,s,a)){var c=t.map(function(e){return e});c.push(o);var f=n.map(function(e){return e});f.splice(i,1);var l=e(c,f);if(l.ok)return l}}}return{array:[],ok:!1}}([t[0]],t.slice(1)).ok?"Yes":"No"]}},function(e,t,n){"use strict";var r=this&&this.__awaiter||function(e,t,n,r){return new(n||(n=Promise))(function(u,i){function o(e){try{c(r.next(e))}catch(e){i(e)}}function a(e){try{c(r.throw(e))}catch(e){i(e)}}function c(e){e.done?u(e.value):new n(function(t){t(e.value)}).then(o,a)}c((r=r.apply(e,t||[])).next())})},u=this&&this.__generator||function(e,t){var n,r,u,i,o={label:0,sent:function(){if(1&u[0])throw u[1];return u[1]},trys:[],ops:[]};return i={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function a(i){return function(a){return function(i){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(u=2&i[0]?r.return:i[0]?r.throw||((u=r.return)&&u.call(r),0):r.next)&&!(u=u.call(r,i[1])).done)return u;switch(r=0,u&&(i=[2&i[0],u.value]),i[0]){case 0:case 1:u=i;break;case 4:return o.label++,{value:i[1],done:!1};case 5:o.label++,r=i[1],i=[0];continue;case 7:i=o.ops.pop(),o.trys.pop();continue;default:if(!(u=(u=o.trys).length>0&&u[u.length-1])&&(6===i[0]||2===i[0])){o=0;continue}if(3===i[0]&&(!u||i[1]>u[0]&&i[1]<u[3])){o.label=i[1];break}if(6===i[0]&&o.label<u[1]){o.label=u[1],u=i;break}if(u&&o.label<u[2]){o.label=u[2],o.ops.push(i);break}u[2]&&o.ops.pop(),o.trys.pop();continue}i=t.call(e,o)}catch(e){i=[6,e],r=0}finally{n=u=0}if(5&i[0])throw i[1];return{value:i[0]?i[1]:void 0,done:!0}}([i,a])}}};Object.defineProperty(t,"__esModule",{value:!0});var i=n(0);function o(e){return r(this,void 0,void 0,function(){var t,n,r,i,c,f;return u(this,function(u){switch(u.label){case 0:return 1===e.length?[2,e]:(t=e.slice(0,Math.ceil(e.length/2)),n=e.slice(Math.ceil(e.length/2)),[4,o(t)]);case 1:return r=u.sent(),[4,o(n)];case 2:i=u.sent(),c=[],u.label=3;case 3:return r.length>0&&i.length>0?[4,a(r[0],i[0])]:[3,5];case 4:return(f=u.sent()?r.shift():i.shift())&&c.push(f),[3,3];case 5:return c.push.apply(c,r.concat(i)),[2,c]}})})}function a(e,t){return r(this,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return console.log("? "+e+" "+t),[4,i.atcoderInput()];case 1:return[2,"<"===n.sent()]}})})}t.default=function(e){return r(this,void 0,void 0,function(){var t,n,r;return u(this,function(u){switch(u.label){case 0:return t=e[0].split(" ").map(function(e){return Number(e)}),n=t[0],t[1],r="A".charCodeAt(0),[4,o(Array.apply(null,new Array(n)).map(function(e,t){return String.fromCharCode(r+t)}))];case 1:return[2,["! "+u.sent().join("")]]}})})}},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("readline")},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){var t=Number(e[0]),n=e[1].split(" ").map(function(e){return Number(e)});return[t+n[0]+n[1]+" "+e[2]]}}]);
//# sourceMappingURL=main.js.map