結果
| 問題 |
No.544 Delete 7
|
| コンテスト | |
| ユーザー |
tera_3939
|
| 提出日時 | 2017-07-15 00:13:37 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 645 bytes |
| コンパイル時間 | 15,558 ms |
| コンパイル使用メモリ | 378,760 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-11-21 16:14:17 |
| 合計ジャッジ時間 | 16,027 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 48 |
コンパイルメッセージ
warning: use of deprecated method `core::str::<impl str>::trim_left_matches`: superseded by `trim_start_matches`
--> src/main.rs:21:29
|
21 | println!("{} {}", res_1.trim_left_matches('0'),
| ^^^^^^^^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
help: replace the use of the deprecated method
|
21 | println!("{} {}", res_1.trim_start_matches('0'),
| ~~~~~~~~~~~~~~~~~~
warning: use of deprecated method `core::str::<impl str>::trim_left_matches`: superseded by `trim_start_matches`
--> src/main.rs:22:34
|
22 | ... res_2.trim_left_matches('0'));
| ^^^^^^^^^^^^^^^^^
|
help: replace the use of the deprecated method
|
22 | res_2.trim_start_matches('0'));
| ~~~~~~~~~~~~~~~~~~
ソースコード
use std::io;
fn get_line() -> String {
let mut input = String::new();
io::stdin().read_line(&mut input).unwrap();
input
}
fn main() {
let input = get_line();
let ret:Vec<(u32, u32)> = input.trim().chars().map(|x| {
let a = x.to_digit(10).unwrap();
(a / 2, a / 2 + (a % 2))
}).collect();
let mut res_1 = String::with_capacity(16);
let mut res_2 = String::with_capacity(16);
for (i, j) in ret {
res_1 = res_1 + &i.to_string();
res_2 = res_2 + &j.to_string();
}
println!("{} {}", res_1.trim_left_matches('0'),
res_2.trim_left_matches('0'));
}
tera_3939