1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

bitset

Last updated at Posted at 2022-02-22

bit演算を高速にしたいときに使う

bitset<長さ> bs(数値);

//<十進数>
bitset<8> bs2(131); 
// 7 ビット目から 0 ビット目への順番で、10000011 となる。

//<二進数>
bitset<8> bs3("10000011"); 
// 7 ビット目から 0 ビット目への順番で、10000011 となる。
bitset<2000> bs4("10000011"); 
// 1999 ビット目から 0 ビット目の順番で、0...010000011 となる。
//計算例
string A; cin >> A;
string B; cin >> B;

bitset<2000> A1(A);
bitset<2000> B1(B);
bitset<2000> ans = (A1 | B1);
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?