結果
| 問題 |
No.423 ハムスター語初級(数詞)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-04-26 11:52:39 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 941 bytes |
| コンパイル時間 | 16,660 ms |
| コンパイル使用メモリ | 379,148 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-11-24 02:15:24 |
| 合計ジャッジ時間 | 17,580 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 6 WA * 3 |
ソースコード
use std::io::{self, BufRead};
fn get_lines() -> Vec<String> {
let stdin = io::stdin();
let lines: Vec<String> = stdin.lock().lines().map(|l| l.unwrap()).collect();
return lines;
}
fn main(){
let s = &get_lines()[0];
let mut ans: u32 = 1;
let mut i = s.chars().skip(4);
let mut x = i.nth(3);
loop {
let c = match x {
Some(x) => x,
None => {
let s = format!("{:b}", ans * 2);
for c in s.chars() {
if c == '1' {
print!("hamu");
} else {
print!("ham");
}
}
println!("");
return;
}
};
if c == 'u' {
ans = ans << 1;
ans += 1;
x = i.nth(3);
} else {
ans = ans << 1;
x = i.nth(2);
}
}
}