Created
January 12, 2026 19:58
-
-
Save icub3d/e79bef44840cb6354d3de46c2ee669a4 to your computer and use it in GitHub Desktop.
Kattis volim
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
| use std::io::{Read, stdin}; | |
| fn main() { | |
| let mut s = String::new(); | |
| stdin().read_to_string(&mut s).unwrap(); | |
| let mut ss = s.lines(); | |
| let mut cur = ss.next().unwrap().parse::<isize>().unwrap(); | |
| ss.next(); | |
| let mut time = 210; | |
| for l in ss { | |
| let (t, r) = l | |
| .split_once(' ') | |
| .map(|(t, r)| (t.parse::<isize>().unwrap(), r)) | |
| .unwrap(); | |
| time -= t; | |
| if time <= 0 { | |
| break; | |
| } | |
| // 1's counting | |
| if r == "T" { | |
| cur = cur % 8 + 1; | |
| } | |
| } | |
| println!("{cur}"); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment