better snippet
This commit is contained in:
parent
5af8e1373e
commit
024226ef53
2 changed files with 13 additions and 24 deletions
|
|
@ -1,24 +0,0 @@
|
|||
---
|
||||
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;
|
||||
}
|
||||
};
|
||||
```
|
||||
13
src/content/gists/noice.mdx
Normal file
13
src/content/gists/noice.mdx
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
title: "noice.cc"
|
||||
date: "07/10/2025"
|
||||
---
|
||||
|
||||
```cpp
|
||||
#include <iostream>
|
||||
|
||||
int main() {
|
||||
std::cout << "I'm surprised that you found this";
|
||||
return 0;
|
||||
}
|
||||
```
|
||||
Loading…
Add table
Add a link
Reference in a new issue