Click here to Skip to main content
15,884,823 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
#include <stdio.h> 
#include <inttypes.h> 
#include <stdlib.h> 
static int64_t metallica[] = { 32538, 37741, 89540, 14627, 34272, 58765 }; 
const static int N = sizeof(metallica)/sizeof(*metallica); 
static void fail(){ 
 puts("Nope!"); 
 exit(EXIT_FAILURE); 
} 
static void the_beatles(int64_t h, int64_t s, int64_t i){ 
 if ( h - i / 7 + 3 * s / 11 ) 
 fail(); 
} 
static void anthrax(int z, int64_t j){ 
 int64_t p = j; 
 for(; z<N; ++z) { 
 if ((z % 2) == 0) 
 continue; 
 p += metallica[z]; 
 } 
 if (p != 69857) 
 fail(); 
} 
static void eagles(int k, int64_t d){ 
 if (k<N) { 
 if (k % 2) 
 eagles(++k, d); 
 else eagles(k + 1, d * metallica[k]); 
 } else if (d != 1269229500) 
 fail(); 
} 
int main(){ 
 int64_t a, e, y; 
 printf("Please enter the right three numbers: "); 
 fflush(stdout); 
 if (scanf("%" SCNd64 " %" SCNd64 " %" SCNd64, &a, &e, &y) != 3) 
 fail(); 
 metallica[0] = a; 
 metallica[5] = e; 
 metallica[4] = y; 
 anthrax(0, 15916); 
 eagles(1, 9); 
 the_beatles(a, e, y); 
 puts("Exactly! Good job."); 
}


What I have tried:

i tried to find out the correct input for above task, please help me
Posted
Updated 12-May-22 1:31am
Comments
Richard MacCutchan 12-May-22 7:28am    
Many people have posted this same question, and the answer is impossible to guess.

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

What I'd suggest you do is start by working out the algorithm by looking at the code and working out what it does with the values and what each segment returns when it passes.
From that you can work out what range(s) of values can pass each stage, and then look for where they overlap.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900