cleanup
This commit is contained in:
parent
17d52f5b07
commit
5af8e1373e
9 changed files with 175 additions and 162 deletions
|
|
@ -12,6 +12,17 @@ const postsCollection = defineCollection({
|
|||
}),
|
||||
});
|
||||
|
||||
const gistsCollection = defineCollection({
|
||||
type: "content",
|
||||
schema: z.object({
|
||||
title: z.string(),
|
||||
description: z.string().optional(),
|
||||
date: z.string().optional(),
|
||||
}),
|
||||
});
|
||||
|
||||
export const collections = {
|
||||
posts: postsCollection,
|
||||
gists: gistsCollection,
|
||||
};
|
||||
|
||||
|
|
|
|||
24
src/content/gists/countGoodNumbers.mdx
Normal file
24
src/content/gists/countGoodNumbers.mdx
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
---
|
||||
title: "countGoodNumbers.cpp"
|
||||
date: "07/10/2025"
|
||||
---
|
||||
|
||||
```cpp
|
||||
class Solution {
|
||||
public:
|
||||
static constexpr long long MOD = 1e9 + 7;
|
||||
long long mpow(long long a, long long b, long long mod=MOD) {
|
||||
long long ans = 1;
|
||||
while (b > 0) {
|
||||
if (b & 1) ans = (ans * a) % MOD;
|
||||
a = (a * a) % MOD;
|
||||
b >>= 1;
|
||||
}
|
||||
return ans;
|
||||
}
|
||||
int countGoodNumbers(long long n) {
|
||||
long long even = (n + 1) / 2, odd = n / 2;
|
||||
return (mpow(5, even) * mpow(4, odd)) % MOD;
|
||||
}
|
||||
};
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue