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
| pub fn diff_ways_to_compute(input: String) -> Vec<i32> { | |
| let chars: Vec<char> = input.chars().collect::<Vec<_>>(); | |
| parse(&chars).into_iter().map(|tree| tree.eval()).collect() | |
| } | |
| fn parse(input: &[char]) -> Vec<AST> { | |
| let mut res = vec![]; | |
| if input.is_empty() { | |
| return res; | |
| } |
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
| #[allow(unused_imports)] | |
| use std::cmp::{min,max}; | |
| use std::io::{BufWriter, stdin, stdout, Write}; | |
| #[derive(Default)] | |
| struct Scanner { | |
| buffer: Vec<String> | |
| } | |
| impl Scanner { | |
| fn next<T: std::str::FromStr>(&mut self) -> T { |
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
| #![no_std] | |
| #![no_main] | |
| // pick a panicking behavior | |
| extern crate panic_halt; // you can put a breakpoint on `rust_begin_unwind` to catch panics | |
| // extern crate panic_abort; // requires nightly | |
| // extern crate panic_itm; // logs messages over ITM; requires ITM support | |
| // extern crate panic_semihosting; // logs messages to the host stderr; requires a debugger | |
| use cortex_m_rt::{entry, exception, ExceptionFrame}; |
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
| /// ```bash | |
| /// cargo run --release | |
| /// # in another term | |
| /// flame -p 9953 | |
| /// # in another term | |
| /// flame -p 9953 | |
| /// ``` | |
| use std::sync::atomic::{AtomicUsize, Ordering}; |
OlderNewer