Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/content/blog-metas/2024-12-14-bsf.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"postDate": "2024-12-14T05:33:42.048Z"
"postDate": "2024-12-14T05:33:42.048Z",
"updateDate": "2024-12-14T12:29:25.532Z"
}
8 changes: 4 additions & 4 deletions src/content/blogs/2024-12-14-bsf.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,23 +128,23 @@ int main(void) {

実は `bsf` 命令はインラインアセンブラを使わなくても、コンパイラの組み込み関数で呼び出すことができます。以下のコードは共に C/C++ どちらでも、GCC/Clang どちらでも通ることを確認しています。

[ビルトイン関数 `__builtin_ctz()` を使う場合](https://atcoder.jp/contests/abs/submissions/60706580):
[ビルトイン関数 `__builtin_ctz()` を使う場合](https://atcoder.jp/contests/abs/submissions/60738100):

```c
#include <stdio.h>

int main(void) {
int N, ans = 100;
scanf("%u", &N);
scanf("%d", &N);

for (int i = 0; i < N; ++i) {
int num, ctz;
scanf("%u", &num);
scanf("%d", &num);
ctz = __builtin_ctz(num);
ans = ans > ctz ? ctz : ans;
}

printf("%u\n", ans);
printf("%d\n", ans);
return 0;
}
```
Expand Down
Binary file modified src/content/blogs/2024-12-14-bsf/ac-ctz.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.