kkmomo

Untitled

Jun 4th, 2014
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 8.09 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. #define BOUND   400000
  5. #define round(x) (int( x * 100 + 0.5 )/100.)
  6. #define ERR 0.000001
  7.  
  8. int gcd(int a, int b) {
  9.     while ((a%=b) && (b%=a));
  10.     return a+b;
  11. }
  12. // ARR_lvl[][2] = {dex_1, dodge_1, dex_2, dodge_2, ...}
  13.  
  14. double ARR_5[][2] = {22,6.08,23,6.36,24,6.63,25,6.91,26,7.18,27,7.46,28,7.74,29,8.01,30,8.29,31,8.57,32,8.84,33,9.12,34,9.39,35,9.67,36,9.95,37,10.22,38,10.5,39,10.78,40,11.05,41,11.33,42,11.61,43,11.88,44,12.16,45,12.43,46,12.71,47,12.99,48,13.26,49,13.54,50,13.82,51,14.09,52,14.37,57,15.75,62,17.13,67,18.51,72,19.89,76,21,152,42,228,63,237,65.49,238,65.76,239,66.04,240,66.32,241,66.59,242,66.87,243,67.14,244,67.42,245,67.7,246,67.97,247,68.25,248,68.53,249,68.8,250,69.08,251,69.36,252,69.63,253,69.91,254,70.18,255,70.46,256,70.74,257,71.01,258,71.29,259,71.57,260,71.84,261,72.12,262,72.39,263,72.67,264,72.95,265,73.22,266,73.5,267,73.78,268,74.05,269,74.33,270,74.61,271,74.88,272,75.16,};
  15. double ARR_6[][2] = {25,6.47,30,7.76,34,8.79,35,9.05,40,10.34,45,11.64,50,12.93,55,14.22,60,15.52,65,16.81,70,18.1,75,19.4,80,20.69,85,21.98,274,70.86,277,71.64,};
  16. double ARR_7[][2] = {28,6.74,40,9.62,45,10.83,50,12.03,55,13.23,60,14.44,65,15.64,70,16.84,75,18.04,80,19.25,85,20.45,90,21.65,95,22.86,100,24.06,105,25.26,280,67.36,306,73.62,296,71.21,273,65.68,274,65.92,275,66.16,276,66.4,277,66.64,278,66.88,};
  17. double ARR_8[][2] = {31,6.89,36,8,41,9.11,46,10.22,51,11.33,56,12.44,61,13.56,66,14.67,71,15.78,76,16.89,81,18,86,19.11,91,20.22,96,21.33,101,22.44,106,23.56,111,24.67,116,25.78,121,26.89,126,28,131,29.11,136,30.22,141,31.33,146,32.44,151,33.56,156,34.67,161,35.78,166,36.89,171,38,};
  18. double ARR_9[][2] = {34,6.93,37,7.54,38,7.74,39,7.95,41,8.36,42,8.56,43,8.76,44,8.97,46,9.38,47,9.58,48,9.78,49,9.99,50,10.19,51,10.39,52,10.6,54,11.01,55,11.21,59,12.02,64,13.04,69,14.06,74,15.08,79,16.1,84,17.12,89,18.14,94,19.16,99,20.18,104,21.2,109,22.21,114,23.23,119,24.25,124,25.27,129,26.29,134,27.31,150,30.57,276,56.25,277,56.45,278,56.66,279,56.86,280,57.07,281,57.27,282,57.47,283,57.68,284,57.88,285,58.08,286,58.29,287,58.49,288,58.7,289,58.9,290,59.1,291,59.31,292,59.51,293,59.71,294,59.92,295,60.12,296,60.33,297,60.53,298,60.73,299,60.94,300,61.14,301,61.35,302,61.55,303,61.75,304,61.96,305,62.16,306,62.36,307,62.57,308,62.77,309,62.98,310,63.18,311,63.38,312,63.59,313,63.79,320,65.22,};
  19. double ARR_10[][2] = {37,6.68,42,7.58,47,8.49,52,9.39,57,10.29,62,11.19,67,12.1,72,13,77,13.9,277,50.01,293,52.9,320,57.78,144,26,216,39,288,52,};
  20. double ARR_11[][2] = {40,6.32,41,6.48,42,6.64,43,6.8,44,6.96,45,7.11,46,7.27,47,7.43,48,7.59,49,7.75,50,7.9,51,8.06,52,8.22,53,8.38,54,8.54,55,8.69,60,9.48,65,10.28,70,11.07,75,11.86,80,12.65,85,13.44,90,14.23,95,15.02,100,15.81,105,16.6,110,17.39,115,18.18,120,18.97,125,19.76,130,20.55,135,21.34,140,22.13,145,22.92,150,23.71,155,24.5,160,25.29,165,26.08,170,26.87,175,27.66,180,28.45,185,29.24,190,30.04,195,30.83,200,31.62,205,32.41,210,33.2,211,33.35,212,33.51,213,33.67,214,33.83,215,33.99,216,34.15,217,34.3,218,34.46,219,34.62,220,34.78,225,35.57,230,36.36,235,37.15,240,37.94,245,38.73,250,39.52,255,40.31,260,41.1,265,41.89,270,42.68,275,43.47,280,44.26,283,44.74,292,46.16,296,46.79,299,47.27,338,53.43,384,60.7,339,53.59,340,53.75,341,53.91,342,54.06,343,54.22,344,54.38,345,54.54,346,54.7,347,54.85,348,55.01,349,55.17,350,55.33,362,57.22,315,49.8,263,41.57,289,45.69,138,21.81};
  21. double ARR_12[][2] = {43,5.88,48,6.56,53,7.25,58,7.93,63,8.61,68,9.3,73,9.98,78,10.66,83,11.35,88,12.03,93,12.71,98,13.4,103,14.08,108,14.77,113,15.45,118,16.13,123,16.82,128,17.5,133,18.18,138,18.87,143,19.55,148,20.23,153,20.92,158,21.6,163,22.29,168,22.97,173,23.65,178,24.34,183,25.02,188,25.7,218,29.8,248,33.91,278,38.01,308,42.11,338,46.21,399,54.55,256,35,282,38.55,285,38.96,291,39.79,288,39.37};
  22. double ARR_13[][2] = {46,5.47,47,5.59,48,5.7,49,5.82,50,5.94,51,6.06,52,6.18,53,6.3,54,6.42,55,6.54,56,6.66,57,6.77,58,6.89,59,7.01,60,7.13,61,7.25,62,7.37,63,7.49,64,7.61,65,7.73,66,7.84,67,7.96,68,8.08,69,8.2,70,8.32,71,8.44,72,8.56,73,8.68,74,8.8,75,8.91,76,9.03,77,9.15,78,9.27,79,9.39,80,9.51,81,9.63,82,9.75,83,9.86,84,9.98,85,10.1,86,10.22,87,10.34,88,10.46,89,10.58,90,10.7,91,10.82,92,10.93,93,11.05,94,11.17,95,11.29,96,11.41,97,11.53,98,11.65,99,11.77,100,11.89,101,12,102,12.12,103,12.24,104,12.36,105,12.48,106,12.6,107,12.72,108,12.84,109,12.95,110,13.07,111,13.19,112,13.31,113,13.43,114,13.55,115,13.67,116,13.79,117,13.91,118,14.02,119,14.14,120,14.26,121,14.38,122,14.5,123,14.62,124,14.74,125,14.86,126,14.98,127,15.09,128,15.21,129,15.33,130,15.45,131,15.57,132,15.69,133,15.81,134,15.93,135,16.05,136,16.16,137,16.28,138,16.4,139,16.52,140,16.64,141,16.76,142,16.88,143,17,144,17.11,145,17.23,146,17.35,147,17.47,148,17.59,149,17.71,150,17.83,151,17.95,152,18.07,153,18.18,154,18.3,155,18.42,156,18.54,157,18.66,158,18.78,159,18.9,160,19.02,161,19.14,162,19.25,163,19.37,164,19.49,165,19.61,166,19.73,167,19.85,168,19.97,169,20.09,170,20.2,171,20.32,172,20.44,173,20.56,174,20.68,175,20.8,176,20.92,177,21.04,178,21.16,179,21.27,180,21.39,181,21.51,182,21.63,183,21.75,184,21.87,185,21.99,186,22.11,187,22.23,188,22.34,189,22.46,190,22.58,191,22.7,192,22.82,193,22.94,194,23.06,195,23.18,196,23.3,197,23.41,198,23.53,199,23.65,200,23.77,201,23.89,202,24.01,203,24.13,204,24.25,205,24.36,206,24.48,207,24.6,208,24.72,209,24.84,210,24.96,211,25.08,212,25.2,213,25.32,214,25.43,215,25.55,216,25.67,217,25.79,218,25.91,219,26.03,220,26.15,221,26.27,222,26.39,223,26.5,224,26.62,225,26.74,226,26.86,227,26.98,228,27.1,229,27.22,230,27.34,231,27.45,232,27.57,233,27.69,234,27.81,235,27.93,236,28.05,237,28.17,238,28.29,239,28.41,240,28.52,241,28.64,242,28.76,243,28.88,244,29,245,29.12,246,29.24,247,29.36,248,29.48,249,29.59,250,29.71,251,29.83,252,29.95,253,30.07,254,30.19,255,30.31,256,30.43,257,30.55,258,30.66,259,30.78,260,30.9,261,31.02,262,31.14,263,31.26,264,31.38,265,31.5,266,31.61,267,31.73,268,31.85,269,31.97,270,32.09,271,32.21,272,32.33,273,32.45,274,32.57,275,32.68,276,32.8,277,32.92,278,33.04,279,33.16,280,33.28,281,33.4,282,33.52,283,33.64,284,33.75,285,33.87,286,33.99,287,34.11,288,34.23,289,34.35,290,34.47,291,34.59,292,34.7,293,34.82,294,34.94,295,35.06,296,35.18,297,35.3,298,35.42,299,35.54,300,35.66,301,35.77,302,35.89,303,36.01,304,36.13,};
  23. double ARR_37[][2] = {150,3.34,155,3.45,160,3.56,165,3.68,170,3.79,175,3.9,180,4.01,185,4.12,190,4.23,195,4.34,200,4.46,205,4.57,210,4.68,215,4.79,220,4.9,225,5.01,230,5.12,235,5.23,240,5.35,245,5.46,250,5.57,557,12.41,797,17.75,};
  24. double ARR_65[][2] = {4258,28.63,4388,29.51,4393,29.54,4398,29.57,4403,29.61,4408,29.64,4498,30.25,2737,18.4,2626,17.66,202,1.36,};
  25. double ARR_67[][2] = {74,0.42,221,1.26,228,1.29,375,2.13,962,5.46,1396,7.93,1849,10.5,};
  26. double ARR_70[][2] = {77,0.35,78,0.36,80,0.37,81,0.37,86,0.4,87,0.4,91,0.42,92,0.42,94,0.43,98,0.45,101,0.47,109,0.5,110,0.51,114,0.53,116,0.53,120,0.55,142,0.65,147,0.68,176,0.81,190,0.88,190,0.88,217,1,242,1.12,569,2.62,644,2.97,649,2.99,649,2.99,762,3.51,1009,4.65,1201,5.54,1581,7.29,2326,10.72,3504,16.15,4660,21.48,7592,35,7801,35.96,9138,42.13,5745,26.49,218,1.01,962,4.44,1270,5.86,1129,5.2,526,2.43,2181,10.05,4285,19.76,3233,14.91,4888,22.54,526,2.43};
  27. #define arr ARR_70
  28.  
  29. // DODGE(%) = arr[k][0]*i/j (%)
  30. void ComputeCoeff() {
  31.     int i, j, k, arrsize;
  32.     double a;
  33.     arrsize = sizeof(arr)/sizeof(double)/2;
  34.     for (i=1; i<BOUND; i++) {
  35.         for (j=1; j< BOUND; j++) {
  36.             for (k=0; k<arrsize; k++) {
  37.                 a = round(arr[k][0]*i/j) - arr[k][1];
  38.                 if (a > ERR || a < -ERR)
  39.                     break;
  40.             }
  41.             if (k==arrsize) {
  42.                 if (gcd(i, j)==1)
  43.                     printf("Dodge Coeff(%%) = %d / %d (%%)\n", i, j);
  44.             }
  45.         }
  46.     }
  47. }
  48.  
  49. // find min difference number
  50. void diff(int a, int b, int c, int d) {
  51.     int i;
  52.     int coeff1[2] = {a, b};
  53.     int coeff2[2] = {c, d};
  54.     double e;
  55.     for (i=1; i<BOUND; i++) {
  56.         e = round((double)i*coeff1[0]/coeff1[1]) - round((double)i*coeff2[0]/coeff2[1]);
  57.         if (e > ERR || e < -ERR) {
  58.             printf("Need to add data of dex : %d, diff is %f%%\n", i, e);
  59.             printf("coeff1 : %d / %d\n", coeff1[0], coeff1[1]);
  60.             printf("coeff2 : %d / %d\n", coeff2[0], coeff2[1]);
  61.             break;
  62.         }
  63.     }
  64. }
  65.  
  66. int main(void) {
  67.     ComputeCoeff();
  68.     //diff(441, 95656, 613, 132964);
  69.     system("pause");
  70.     return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment