Advertisement
EddyCZ

test

Oct 27th, 2018
270
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.91 KB | None | 0 0
  1. // DLL.cpp : Defines the exported functions for the DLL application.
  2. //
  3.  
  4. #include "stdafx.h"
  5.  
  6. int Collatz(int ans)
  7. {
  8.     while (ans != 1) {
  9.         if (ans % 2 == 1)
  10.             ans = (3 * ans) + 1;
  11.         else
  12.             ans /= 2;
  13.  
  14.         return ans;
  15.     }
  16.     return 0;
  17. }
  18.  
  19. int GetInstr(int Number)
  20. {
  21.     int a1 = 2;
  22.     int b1 = 4;
  23.     int c1 = 6;
  24.     int d1 = 8;
  25.  
  26.     int a0 = 128;
  27.     int b0 = 256;
  28.     int c0 = 512;
  29.     int d0 = 10420;
  30.  
  31.     unsigned int NUM1 = 0;
  32.     unsigned int NUM2 = 0;
  33.     unsigned int NUM3 = 0;
  34.     unsigned int NUM4 = 0;
  35.  
  36.     for (int a = 10; a < a0; a++)
  37.     {
  38.         int p1 = a * a1 >> Numbera;
  39.         NUM1 += Collatz(p1);
  40.     }
  41.  
  42.     for (int b = 20; b < b0; b++)
  43.     {
  44.         int p2 = b * b1 ^ Number;
  45.         NUM2 += Collatz(p2);
  46.     }
  47.  
  48.     for (int c = 30; c < c0; c++)
  49.     {
  50.         int p3 = c * c1 << Number;
  51.         NUM3 += Collatz(p3);
  52.     }
  53.  
  54.     for (int d = 40; d < d0; d++)
  55.     {
  56.         int p4 = d * d1 || Number;
  57.         NUM4 += Collatz(p4);
  58.     }
  59.  
  60.     return (NUM1 ^ NUM4) / (NUM2 >> NUM3);
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement