Created
February 25, 2019 07:39
-
-
Save ryu1-1uyr/4db5fb3630400886fc52f9473e97cc4a to your computer and use it in GitHub Desktop.
using ramda.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const R = require('ramda'); | |
process.stdin.resume(); | |
process.stdin.setEncoding('utf8'); | |
let lines = []; | |
let reader = require('readline').createInterface({ | |
input: process.stdin, | |
output: process.stdout | |
}); | |
reader.on('line', (line) => { | |
lines.push(line); | |
}); | |
reader.on('close', () => { | |
console.log("\n"); | |
let numsRange,firstNumber,lastNumber; | |
[numsRange,firstNumber,lastNumber]=lines[0].split(' ').map((x)=>x-[]) | |
let differenceNum = R.range(firstNumber,lastNumber+=1) | |
differenceNum.forEach((x)=>{ | |
console.log( (x+"").padStart(3, "0") ) | |
}) | |
}); |
let numsRange,firstNumber,lastNumber;
[numsRange,firstNumber,lastNumber]=lines[0].split(' ').map((x)=>x-[])
一行でかける
const [numsRange,firstNumber,lastNumber] = lines[0].split(' ').map(x => x - [])
あとはメソッドチェーン使え
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
インデントずれているぞ
とり急ぎ,ES6で書いた
https://gist.github.com/omas-public/6b71436c66a56dfbce26e384b5039fca