Advertisement
kolioi

Untitled

Dec 12th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.59 KB | None | 0 0
  1. //100/100
  2. //Memory: 1.52 MB Time : 0.073 s
  3. #include <stdio.h>
  4.  
  5. #define DNA_LENGTH      5
  6. #define MAGIC_NUMBER        1001
  7. #define DOT             46
  8.  
  9. char buf[MAGIC_NUMBER], result[DNA_LENGTH + 1];
  10. unsigned short index;
  11.  
  12. int main()
  13. {
  14.     while (1)
  15.     {
  16.         fgets(buf, MAGIC_NUMBER, stdin);
  17.         index = 0;
  18.         while (index < MAGIC_NUMBER)
  19.         {
  20.             if (*(buf + index) == DOT)
  21.             {
  22.                 puts(result);
  23.                 return 0;
  24.             }
  25.             result[0] ^= *(buf + index++);
  26.             result[1] ^= *(buf + index++);
  27.             result[2] ^= *(buf + index++);
  28.             result[3] ^= *(buf + index++);
  29.             result[4] ^= *(buf + index++);
  30.         }
  31.     }
  32.  
  33.     return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement