Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include "guess_max_fn.c"
- int main(int argc, char * argv[]) {
- int N, count, real_idx;
- double real_max = -1;
- double your_max = -1;
- int your_idx = -1;
- int done = 0;
- scanf("%d", &N);
- for(count=1; count<=N; count++) {
- double x;
- scanf("%lf", &x);
- if (!done && (done=guess_max(x, N, count))) {
- your_max = x;
- your_idx = count;
- }
- if (real_max < x) {
- real_max = x;
- real_idx = count;
- }
- }
- if(your_max < real_max) {
- printf("Pudło! (N=%d); Real max:%.15f (idx=%d); Your choice:%.15f (idx=%d)\n", N, real_max, real_idx, your_max, your_idx);
- }else{
- printf("Trafiony! (N=%d) idx=%d max=%.15f\n", N, real_idx, real_max );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement