BufReader官方文档:https://doc.rust-lang.org/stable/std/io/struct.BufReader.html
use std::io::{self, BufRead, BufReader};
let mut cin = BufReader::new(io::stdin());
// cin.read_line
注意用了BufReader
来优化stdin读取之后,一定就不能再用io::stdin()
来直接读取了,不然会乱套。
BufReader官方文档:https://doc.rust-lang.org/stable/std/io/struct.BufReader.html
use std::io::{self, BufRead, BufReader};
let mut cin = BufReader::new(io::stdin());
// cin.read_line
注意用了BufReader
来优化stdin读取之后,一定就不能再用io::stdin()
来直接读取了,不然会乱套。
Except as otherwise noted, this blog is licensed under CC BY-SA 4.0 License.
©2021-
searchstar
|
pv
|
uv
Theme Tree
by Wu Jun
Powered by Hexo