题解 | #求int型正整数在内存中存储时1的个数#
求int型正整数在内存中存储时1的个数
http://www.nowcoder.com/practice/440f16e490a0404786865e99c6ad91c9
use std::io::{self, *};
use std::str::FromStr;
fn main() {
let stdin = io::stdin();
for line in stdin.lock().lines() {
println!("{}",(i32::from_str(line.unwrap().as_str()).unwrap()).count_ones());
}
}
用 Rust 刷华为机试HJ 文章被收录于专栏
用 Rust 刷 HJ100 题,只需要懂基础 Rust 语法就能看懂
顺丰集团工作强度 382人发布