Tuesday, August 27, 2019

Inline Assembly


Below is an example of inline assembly in C++. Notice that it is x86 assembly with the AT&T syntax. The final value of b is 10.

Saturday, April 27, 2019

Codeforces Div 2: 78B

Easter eggs - 78B

Here is my solution: keeping in mind the main 2 conditions:
  1. Each color must bu used at least once.
  2. Every 4 successive colors must be different.

 Firstly, we can consider the first 3 colors to be Red, Orange and Yellow for example.
The remaining 4 colors will be added after that depending on the number of eggs; suppose that our first string is "ROY", the second would be "GBIV"; we will print both strings firstly "ROYGBIV" and then add a character at a tim from the second string; this ensures that no 4 successive eggs have the same color.

Here is my C++ code: