jingxun
3 years ago
1 changed files with 15 additions and 0 deletions
@ -0,0 +1,15 @@ |
|||
fn main() { |
|||
let mut out = vec![1, 1]; |
|||
let n = 20; |
|||
let res; |
|||
if n <= 2 { |
|||
let idx = n as usize; |
|||
res = &out[..idx]; |
|||
} else { |
|||
for i in 0..n - 2 { |
|||
out.push(out[i as usize] + out[i + 1 as usize]); |
|||
} |
|||
res = &out; |
|||
} |
|||
println!("{:?}",res); |
|||
} |
Loading…
Reference in new issue