请帮助我创建一个程序,该程序输出可能的数字列表,其中包含N范围内的所有数字(N是输入数字),但不应有连续的数字
示例:
N=4
n = 0,1,2,3
1032 False because (1 behind 0) and (3 behind 2)
1230 False because (1 behind 2) and (2 behind 3)
2031 True because there no two consecutive numbers one behind the other
List=[1302,2031]
答案 0 :(得分:0)
请检查以下内容:
const ECont = EitherT(Cont)
const decode = buf => buf.toString("utf8")
const foo = readFile("foo.txt") |> ECont.map(decode)
const bar = readFile("bar.txt") |> ECont.map(decode)
// Imaginary do notation for JS for purposes of clarity
const result = do(ECont)([
[s1, foo],
ECont.lift(delay_(5000)),
[s2, bar],
ECont.pure(s1 + s2)
])
const panic = e => { throw e }
const log = v => { console.log(v) }
// No side effects actually happen until the next line is invoked
result(Either.match({ Left: panic, Right: log }))
此实际工作仅当“n”为奇数。 我希望你能计算偶数的情况。 如果没有,请告诉我