If XOR of n distinct numbers is ANDed over one of the number, the result would be zero

Say we Have n distinct numbers


And we xor the result

xoredResult = x1^x2...^xn 

And if we AND(&) with one of the number say x2 We get Zero

xoredResult & x2 = 0 

Can we always claim that if the ANDed result is zero that the number is repeated ? Can this be used to find the first repeated element in a stream of numbers ?

Zero knowledge about sdl/sdl2.h [closed]

I am beginner coder,I learn c language basics and when,when I download c4droid app and I found some c4droid examples in which the folder having SDL in which demo.c file is there,I compiled ,then I knew that sdl.h is amazing but I don’t understand anything in this program and please help me to understand this code and “HOW I COULD START LEARN SDL IN C ONLY”.please help me

#include <stdio.h> #include <SDL.h> #define WIDTH 640 #define HEIGHT 480 #define BPP 4 #define DEPTH 32  void setpixel(SDL_Surface *screen, int x, int y, Uint8 r, Uint8 g, Uint8 b) {     Uint32 *pixmem320;     Uint32 colour;        colour = SDL_MapRGB( screen->format, r, g, b);       pixmem320 = (Uint32*) screen->pixels + y + x;     *pixmem320= colour; }  void DrawScreen(SDL_Surface* screen, int h) {      int x, y, ytimesw;    if(SDL_MUSTLOCK(screen))      {         if(SDL_LockSurface(screen) < 0)          return;     }     for(y = 0; y < screen->h; y++ )      {         ytimesw = y*screen->pitch/BPP;         for( x = 0; x < screen->w; x++ )          {             setpixel(screen, x, ytimesw, (x*x)/256+3*y+h, (y*y)/256+x+h, h);         }     }     if(SDL_MUSTLOCK(screen)) SDL_UnlockSurface(screen);     SDL_Flip(screen);  }  int main(int argc, char* argv[]) {     SDL_Surface *screen;     SDL_Event event;       int keypress = 0;     int h=0;      if (SDL_Init(SDL_INIT_VIDEO) < 0 ) return 1;     if (!(screen = SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, SDL_FULLSCREEN|SDL_HWSURFACE)))     {         SDL_Quit();         return 1;     }     while(!keypress)      {          DrawScreen(screen,h++);          while(SDL_PollEvent(&event))           {                     switch (event.type)                {                   case SDL_QUIT:                   keypress = 1;                   break;                   case SDL_KEYDOWN:                   keypress = 1;                   break;               }          }     }     SDL_Quit();     return 0; } 

And this is code in c4droid examples demo.c

Can Raise Dead revive a character with zero maximum Hit Points?

So, a character died from Draining Kiss of a succubus and his Max HP is 0. Can he be restored by Raise Dead, or does he need a higher level spell? Or a Greater Restoration cast on his lifeless body before Raise dead? I’m probably interested in RAW interpretation, since the character is in Adventurerer’s league.

Reverse engineering and buffer overflows: zero to hero

When I do CTFs, I can usually cope well with and understanding everything pretty much apart from buffer overflows, binary exploitation and reverse engineering

Almost to the point that I would consider myself having zero knowledge at all. I grasp the concept at the very most basic of levels and by that I mean I can operate a mouse and keyboard

Is there anywhere that takes you from zero to hero? I’m currently doing CTFs on https://0x0539.net/ and have done most of them apart from reverse engineering ones.

https://liveoverflow.com/ is a decent start I believe but was wondering where there was a book, an online resource that as I say, could take me from zero to hero

I understand there’s a “stack” and “memory” and “assembly language” and then after that… nothing.

Specifically – I would like to get to a point where I come across a related challenge in a CTF and at least know where to start, where to go and how to complete it


Replace function and its derivatives by zero

If I try to replace the function u0 and its derivatives by zero in the following examplary expression

expr = t HeavisideTheta[0.174 +φ] - 1651.2 u0[t, φ] + 3293.841 t Derivative[0, 1][u0][t, φ]; expr/.u0->(0&) (*0. + t HeavisideTheta[0.174 + φ]*) 

Mathematica gives an output 0.+....

My question: How can I avoid this zero part 0.+ in the output(without using Chop) ? Thanks!

Does a troll die if its maximum hit points is zero?

The Troll has the Regeneration feature which states:

The troll regains 10 hit points at the start of its turn. If the troll takes acid or fire damage, this trait doesn’t function at the start of the troll’s next turn. The troll dies only if it starts its turn with 0 hit points and doesn’t regenerate.

I’m wondering what happens when even a trolls maximum hit points has been reduced to zero. I don’t know if this method works to kill a troll because I’m unsure whether they have actually regenerated or not. Does the troll die?

How to balance an encounter with Challenge Rating zero creatures against PCs?

The Homonculus is described as a Challenge Rating (CR) 0 creature with five hit points and a poison attack that if PCs fail a DC10 CON check by five causes unconsciousness for 1d10 minutes.

According to the MM (p.9):

A monster’s challenge rating tells you how great a threat the monster is. An appropriately equipped and well-rested party of four adventurers should be able to defeat a monster that has a challenge rating equal to its level without suffering any deaths. For example, a party of four 3rd-level characters should find a monster with a challenge rating of 3 to be a worthy challenge, but not a deadly one.

As we understand it, a CR1 creatures is considered an even match for four level 1 PCs. A CR 1/8 creature would need eight creatures to be an even match for level 1 PCs.

That math doesn’t seem to work out for CR0 creatures as it seems to imply an infinite number of creatures would be required to create an even match.

How does one calculate an even match with CR0 creatures? Given the Homonculi’s rather powerful poison attack, how many Homonculi would be an even match for a party of Level 1 PCs?