目次

カッコの位置のミス

// ↓間違い
let all = (n * (n + 1) * (2 * n + 1)) + 3 * n * (n + 1) / 12;

// ↓正しい
let all = (n * (n + 1) * (2 * n + 1) + 3 * n * (n + 1)) / 12;

参考: ABC371 の動画(1:40:00)

tuple_windows/tuple_combinations

tuple_windows と入力しようとしたら、tuple_combinations が補完の先頭に来て tuple_combinations が入力されてしまったというのがよくある。

tuple_windows も tuple_combinations も型が実質同じなせいで、気づくのも難しい。

参考: Rust itertools あるある: tuple_windows と tuple_combinations を間違える(Youtube のクリップ)

match文 (ARC183 A)

i=3 のとき100、それ以外のとき1を出力しようとしたけど、すべて100が出力されてしまった

image.png

参考: https://youtu.be/s1mOBziNMwg?si=bkYbntnI1VQQkqb7&t=2350 (ARC183 A の動画)

構成問題で Yes 出力し忘れ (ABC362 C)

↓こう出力すべきだったが、Yes を出力し忘れた

Yes
X_1 X_2 ... X_n

ループ継続条件が a*a≤ n みたいな場合 (ABC361 F)