a.rs (355B)
1 mod common; 2 use common::*; 3 4 pub fn main() { 5 let play_score = |s: &[u8]| (s[2] as i64) - ('X' as i64) + 1; 6 let win_score = |s: &[u8]| { 7 let other = s[0] as i64 - ('A' as i64); 8 let me = s[2] as i64 - ('X' as i64); 9 3 * ((me - other + 4) % 3) 10 }; 11 let score = get_score(play_score, win_score); 12 println!("{score}"); 13 }