diff --git a/content/blog/LearningRustThoughKyouPro/Ex1/index.md b/content/blog/LearningRustThoughKyouPro/Ex1/index.md index 819d1ef..5f48b89 100644 --- a/content/blog/LearningRustThoughKyouPro/Ex1/index.md +++ b/content/blog/LearningRustThoughKyouPro/Ex1/index.md @@ -1,7 +1,7 @@ --- title: "[番外編] アルゴリズム・データ構造ごとに問題を分類してみる" postdate: "2023-11-23" -update: "2023-12-16" +update: "2023-12-19" seriesName: "競プロで学ぶRust" seriesSlug: "LearningRustThoughKyouPro" description: "アルゴリズムやデータ構造ごとに解ける問題を分類しました。" @@ -1474,6 +1474,51 @@ mod tests { ``` + +## 最小公倍数 + +### ABC148 C - Snack + +[C - Snack](https://atcoder.jp/contests/abc148/tasks/abc148_c)(Difficulty : 82) + +
+コード例を見る + +```rust +// https://atcoder.jp/contests/abc148/tasks/abc148_c + +fn gcd(m: usize, n: usize) -> usize { + if n == 0 { + m + } else { + gcd(n, m % n) + } +} + +pub fn run(a: usize, b: usize) -> usize { + a / gcd(a, b) * b +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test () { + assert_eq!(6, run(2, 3)); + assert_eq!(18696, run(123, 456)); + assert_eq!(9999900000, run(100000, 99999)); + } +} +``` +
+ + + ## 回文判定 ### 競技プログラミングの鉄則 B56 - Palindrome Queries diff --git a/src/__generated__/gatsby-types.ts b/src/__generated__/gatsby-types.ts index 4e1a12b..9b48faf 100644 --- a/src/__generated__/gatsby-types.ts +++ b/src/__generated__/gatsby-types.ts @@ -4098,7 +4098,7 @@ type Unnamed_1_Query = { readonly allKeywordSearchJson: { readonly edges: Readon type Unnamed_2_QueryVariables = Exact<{ [key: string]: never; }>; -type Unnamed_2_Query = { readonly site: Maybe<{ readonly siteMetadata: Maybe> }> }; +type Unnamed_2_Query = { readonly site: Maybe<{ readonly siteMetadata: Maybe> }> }; type Unnamed_3_QueryVariables = Exact<{ [key: string]: never; }>; @@ -4134,6 +4134,6 @@ type GatsbyImageSharpFluid_withWebp_noBase64Fragment = Pick; -type Unnamed_4_Query = { readonly site: Maybe<{ readonly siteMetadata: Maybe> }> }; +type Unnamed_4_Query = { readonly site: Maybe<{ readonly siteMetadata: Maybe> }> }; } \ No newline at end of file