Advertisement
Guest User

Untitled

a guest
Jul 10th, 2016
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1.  
  2. double oracle_predicted;
  3.  
  4. FILE *fopen(const char *load, const char *mode)
  5. {
  6.     int N, count;
  7.     double real_max = -1;
  8.     FILE *f;
  9.     fopen_s(&f, load, mode);
  10.  
  11.     fscanf(f, "%d", &N);
  12.  
  13.     for(count=1; count<=N; count++) {
  14.         double x;
  15.         fscanf(f, "%lf", &x);
  16.         if (real_max < x) {
  17.             real_max = x;
  18.         }
  19.     }
  20.     fclose(f);
  21.     oracle_predicted=real_max;
  22.     fopen_s(&f, load, mode);
  23.     return f;
  24. }
  25.  
  26.  
  27. int guess_max(double x, int N, int count)
  28. {
  29.     if(x==oracle_predicted)return 1;
  30.     return 0;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement