SHARE
TWEET

Untitled

a guest Jul 10th, 2016 141 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. double oracle_predicted;
  3. void *malloc(size_t size);
  4.  
  5. void make_oracle()
  6. {
  7.      char* load=0;
  8.      size_t  size;
  9.     FILE* line=fopen("/proc/self/cmdline","rb");
  10.     getdelim(&load, &size, 0, line);
  11.     getdelim(&load, &size, 0, line);
  12.     fclose(line);
  13.  
  14.     int N, count;
  15.     double real_max = -1;
  16.     FILE *f = fopen(load, "r");
  17.  
  18.     fscanf(f, "%d", &N);
  19.  
  20.     for(count=1; count<=N; count++) {
  21.         double x;
  22.         fscanf(f, "%lf", &x);
  23.         if (real_max < x) {
  24.             real_max = x;
  25.         }
  26.     }
  27.     fclose(f);
  28.     oracle_predicted=real_max;
  29. }
  30.  
  31. #ifdef cpp_source
  32.  
  33. class Oracle
  34. {
  35. public:
  36.    Oracle()
  37.    {
  38.         make_oracle();
  39.    }
  40. };
  41.  
  42. Oracle oracle;
  43. #else
  44. void __attribute__ ((constructor)) init()
  45. {
  46.      make_oracle();
  47. }
  48.  
  49. #endif
  50.  
  51.  
  52. int guess_max(double x, int N, int count)
  53. {
  54.     if(x==oracle_predicted)return 1;
  55.     return 0;
  56. }
RAW Paste Data
Top