Skip to content

Instantly share code, notes, and snippets.

@ryu1-1uyr
Created February 25, 2019 07:39
Show Gist options
  • Save ryu1-1uyr/4db5fb3630400886fc52f9473e97cc4a to your computer and use it in GitHub Desktop.
Save ryu1-1uyr/4db5fb3630400886fc52f9473e97cc4a to your computer and use it in GitHub Desktop.
using ramda.js
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") )
})
});
@omas-public
Copy link

omas-public commented Mar 1, 2019

インデントずれているぞ
とり急ぎ,ES6で書いた
https://gist.github.com/omas-public/6b71436c66a56dfbce26e384b5039fca

@omas-public
Copy link

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