use std::io::{self, BufRead, BufReader, Read, Stdin}; use std::str::FromStr; use std::string::String; #[derive(Debug)] pub struct Scanner { reader: BufReader, } fn scanner() -> Scanner { Scanner::new(io::stdin()) } impl Scanner { pub fn new(read: R) -> Scanner { Scanner { reader: BufReader::new(read), } } pub fn next_str(&mut self) -> Option { let mut buf = [0; 1]; let size = self.reader.read(&mut buf).unwrap(); if size == 0 { None } else { self.skip_whitespace(&mut buf)?; let mut v = vec![buf[0]]; loop { let size = self.reader.read(&mut buf).unwrap(); if size == 0 || buf[0].is_ascii_whitespace() { break; } v.push(buf[0]); } Some(String::from_utf8(v).unwrap()) } } pub fn next_line(&mut self) -> String { let mut line = String::new(); self.reader.read_line(&mut line).unwrap(); line } pub fn next_vec(&mut self, size: u32) -> Vec { let mut v: Vec = vec![]; for _ in 0..size { let token = self.next_str().unwrap(); v.push(S::from_str(&token).ok().unwrap()); } v } pub fn next_as(&mut self) -> Option { let s = self.next_str()?; S::from_str(&s).ok() } pub fn str(&mut self) -> String { self.next_str().unwrap() } pub fn i32(&mut self) -> i32 { self.next_as::().unwrap() } pub fn u32(&mut self) -> u32 { self.next_as::().unwrap() } pub fn i64(&mut self) -> i64 { self.next_as::().unwrap() } pub fn u64(&mut self) -> u64 { self.next_as::().unwrap() } pub fn f32(&mut self) -> f32 { self.next_as::().unwrap() } pub fn f64(&mut self) -> f64 { self.next_as::().unwrap() } fn skip_whitespace(&mut self, mut buf: &mut [u8]) -> Option { loop { if !buf[0].is_ascii_whitespace() { return Some(buf[0]); } let size = self.reader.read(&mut buf).unwrap(); if size == 0 { return None; } } } } fn main() { let mut sc = scanner(); let mut n = sc.i32(); let mut ans = Vec::::new(); let cnt = [720, 360, 180, 30, 6, 1]; let sym: Vec = "CMSRo.".chars().collect(); while n > 0 { for i in 0..cnt.len() { if n >= cnt[i] { ans.push(sym[i]); n -= cnt[i]; break; } } } println!("{}", String::from_iter(ans)); }