-
Notifications
You must be signed in to change notification settings - Fork 22
Add more examples #64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more examples #64
Conversation
70eebb9
to
820d764
Compare
(edit)
|
820d764
to
168e020
Compare
東京海上日動 プログラミングコンテスト2020: A - Nickname
let c = AsciiChar::A;
let c = AsciiChar::from_ascii('A').unwrap();
let s = AsciiStr::from_ascii("abc").unwrap(); なのでbyte (string) literalがある let c = b'a';
let s = b"abc"; この問題では
という長所を生かすことができる。 |
東京海上日動 プログラミングコンテスト2020: C - Lamps シンプルな1次元0次いもす法を S と A を 下手に |
https://github.com/rust-lang-ja/atcoder-rust-base/pull/64/checks?check_run_id=769219266 マクロ( AtCoderはしばらく1.42.0で固定だろうし |
ありがとうございます。なるほど、今までその clippy の warning はマクロで展開される変数には効いていなかったのですね。 今回のこの警告に関しては無視するのでよいと思います。この警告は Rust 的ではない点の指摘というよりは単に可読性についてのアドバイスと思われるので、問題文に合わせたほうがむしろ可読性が高まる競プロの文脈では構わないと個人的に思うからです。ただこの場合 確かにこのプロジェクトのターゲットは stable, nightly ではなく 1.42.0 になるので、外してもいいかもしれませんね。例えば、将来に代替物ができて非推奨になった機能に対して warning が出るなどとなっても本質的に邪魔なだけですし...。 |
Co-authored-by: statiolake <statiolake@gmail.com>
ABC169 - C - Multiplication 3
num_rational::Ratio
を使う。Bは小数点下が2桁で固定なので
(_.replace('.', "") + "/100").parse().unwrap()
としてパースできる。 そして後は何も考えずに(a * b).to_integer()
を答えとすれば良い。