結果
問題 |
No.2314 Backflip
|
ユーザー |
|
提出日時 | 2023-05-28 12:46:51 |
言語 | Rust (1.83.0 + proconio) |
結果 |
AC
|
実行時間 | 1 ms / 2,000 ms |
コード長 | 1,076 bytes |
コンパイル時間 | 14,014 ms |
コンパイル使用メモリ | 376,736 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-26 19:31:31 |
合計ジャッジ時間 | 15,144 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 8 |
コンパイルメッセージ
warning: variable does not need to be mutable --> src/main.rs:33:9 | 33 | let mut s = input_chars(); | ----^ | | | help: remove this `mut` | = note: `#[warn(unused_mut)]` on by default warning: function `input_num` is never used --> src/main.rs:1:4 | 1 | fn input_num() -> usize { | ^^^^^^^^^ | = note: `#[warn(dead_code)]` on by default warning: function `input_nums` is never used --> src/main.rs:13:4 | 13 | fn input_nums() -> (usize, usize, usize) { | ^^^^^^^^^^ warning: function `input_vec_nums` is never used --> src/main.rs:24:4 | 24 | fn input_vec_nums() -> Vec<usize> { | ^^^^^^^^^^^^^^
ソースコード
fn input_num() -> usize { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim().parse().unwrap() } fn input_chars() -> Vec<char> { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim().chars().collect() } fn input_nums() -> (usize, usize, usize) { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); let mut iter = line.split_whitespace(); ( iter.next().unwrap().parse().unwrap(), iter.next().unwrap().parse().unwrap(), iter.next().unwrap().parse().unwrap() ) } fn input_vec_nums() -> Vec<usize> { let mut line: String = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.split_whitespace() .map(|x| x.parse().unwrap()) .collect() } fn main() { let mut s = input_chars(); let n = s.len(); for i in 0..n { print!("{}{}", if i == n-1 {if s[i] == '1' {'0'} else {'1'}} else {s[i]}, if i == n-1 {"\n"} else {""}); } }