Created
July 7, 2021 17:51
-
-
Save tokugh/d0b877d38ef4750985f22a4f6ab9113a to your computer and use it in GitHub Desktop.
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
fn main() { | |
proconio::input! { | |
_n: usize, | |
s: String, | |
} | |
let mut cnt: i64 = 0; | |
for (i, c) in s.chars().enumerate() { | |
match c { | |
'c' => {cnt += 2 << i;}, | |
'b' => {cnt += 1 << i;}, | |
_ => {}, | |
} | |
} | |
println!("{}", cnt); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment