Блог пользователя sourabh_jangid

Автор sourabh_jangid, история, 4 года назад, По-английски

I was solving 691E - Xor-sequences, and in the problem asked to find number of ones in binary representation of a number, I was using C++ STL __builtin_popcount() function to find Number of ones, but when I submitted I got wrong answer verdict, and then I wrote my own function to count Number of ones and then my solution passed. Can anyone explain to me why this is happening? My AC 69283580 code and WA 69283537 code.

  • Проголосовать: нравится
  • -8
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится -6 Проголосовать: не нравится

int __builtin_popcount(unsigned int)

It returns the numbers of set bits in an integer (the number of ones in the binary representation of the integer). val is long long

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Use __builtin_popcountll(x) for long long ints.

69284505 : Accepted code with __builtin_popcountll(x) in place of __builtin_popcount(x)