fork download
  1. #include <iostream>
  2. #include <stdint.h>
  3. using namespace std;
  4.  
  5. int main() {
  6. for (int c = 1; c <= 120; c++)
  7. {
  8. int32_t expected = (int)(0.02035*c*c - 2.4038*c);
  9. int32_t result = (c*((c * 0x535A8) - 0x2675F70));
  10. if (result < 0)
  11. result += 0xffffff;
  12. result = result>>24;
  13. cout << expected << " " << result << endl;
  14. }
  15. return 0;
  16. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
-2 -2
-4 -4
-7 -7
-9 -9
-11 -11
-13 -13
-15 -15
-17 -17
-19 -19
-22 -22
-23 -23
-25 -25
-27 -27
-29 -29
-31 -31
-33 -33
-34 -34
-36 -36
-38 -38
-39 -39
-41 -41
-43 -43
-44 -44
-45 -45
-47 -47
-48 -48
-50 -50
-51 -51
-52 -52
-53 -53
-54 -54
-56 -56
-57 -57
-58 -58
-59 -59
-60 -60
-61 -61
-61 -61
-62 -62
-63 -63
-64 -64
-65 -65
-65 -65
-66 -66
-66 -66
-67 -67
-68 -68
-68 -68
-68 -68
-69 -69
-69 -69
-69 -69
-70 -70
-70 -70
-70 -70
-70 -70
-70 -70
-70 -70
-70 -70
-70 -70
-70 -70
-70 -70
-70 -70
-70 -70
-70 -70
-70 -70
-69 -69
-69 -69
-68 -68
-68 -68
-68 -68
-67 -67
-67 -67
-66 -66
-65 -65
-65 -65
-64 -64
-63 -63
-62 -62
-62 -62
-61 -61
-60 -60
-59 -59
-58 -58
-57 -57
-56 -56
-55 -55
-53 -53
-52 -52
-51 -51
-50 -50
-48 -48
-47 -47
-46 -46
-44 -44
-43 -43
-41 -41
-40 -40
-38 -38
-36 -36
-35 -35
-33 -33
-31 -31
-29 -29
-28 -28
-26 -26
-24 -24
-22 -22
-20 -20
-18 -18
-16 -16
-13 -13
-11 -11
-9 -9
-7 -7
-5 -5
-2 -2
0 0
2 2
4 4