2022-05-12から1日間の記事一覧
素数判定 任意の値 x が素数かどうか で求める #include <bits/stdc++.h> namespace NyaaLIB_NTL { namespace IsPrime { using ll = long long; auto is_prime = [&](ll x) -> bool { // x が素数か判定 O(√x) if (x <= 1) return false; for (ll i = 2; i * i <= x; i++) i</bits/stdc++.h>…