### The Walkies Trick

/* THIS IS A TURBO C++ CODE*/

/*the question is that their are some walkie talkies in their early
development stages a person buys some. these walkies talkies are beta
versions still under development. but he buys them anyways. now the promplem
arising in them is that though they are made to talk privately at
any range(1 to 1 no other can listen) but right now that is possible
at only a certain range.the twist is that if there are 3(number of walkies
is "n") walkies at given coordinates"x" and"y"(input by user and the range "r"
is given (input by user) and out off these three suppose walkie 1 is in
range of walkie 2 and walkie 1 is also in range with walkie 3 but walkie
2 and 3 are not in range with each other then the also they can privately
talk with each other through the number 2 walkie. we are to get the input
of the number of test cases "t" in which "n" "r" "x" and "y" can change
and also get the input for the coordinates range and number of walkies
and then calculate if ALL of them are capable of talking to each other
privately or not.*/

/*This code is a better version of what i gave in the compitition. but there
seams to be an error in it as it is not giving the desired out put. Please rectify if you have the time and dedication.
thanks.*/

 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859`` ``````#include #include #include #include void main() { clrscr(); long double t,n,r,temp1,temp2,temp3,temp4[100]; long double x[15],y[15]; char ans; cin>>t; cin>>n; cin>>r; if(t>0 && t<11 && n>0 && n<11 && r>-30000 && r<30000) { for(int j=1;j<=t ;j++) { { for(int i=1; i<=n; i++) { cin>>x[i]; cin>>y[i]; } for(int k=1; k<=n; k++) { temp1=x[k+1]-x[k]; temp2=y[k+1]-y[k]; temp3=pow(temp2,2)+pow(temp1,2); temp4[k]=pow(temp3,0.5); if(temp4[k]

Here the code.... I am a c++ cbse board (India) student studying in class xii and I will also discuss with my teacher. But will be grateful if any of you can help me out.
Cheers
Katyayn
Last edited on
@Katyayn:

hmm, interesting question. I am currently short of time, but soon I will look up on your code and try to figure out the problem.

BTW, I am also Indian studying in class XI CBSE Board :)
If you need any other help, PM me.

-Himansh
Last edited on
Topic archived. No new replies allowed.