Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Binary SearchIntervals You have to manage indexes and list of a 2 dimensional array in this puzzle. You also discover the binary search algorithm and

Binary SearchIntervals

You have to manage indexes and list of a 2 dimensional array in this puzzle. You also discover the binary search algorithm and finally, it makes you know that batman is really good at cleaning windows.

External resources

Multidimensional arrayBinary search2D Binary Search explained by Gaurav Sen

STATEMENT

The goal of this puzzle is to guess the coordinate of a bomb (line and column of a 2 dimensional array). You will have to make a guess at each step of the puzzle and adjust it from given feedbacks. Of course, you have a limited number of guess.

#include #include #include #include

using namespace std;

/** * Auto-generated code below aims at helping you parse * the standard input according to the problem statement. **/ int main() { int W; // width of the building. int H; // height of the building. cin >> W >> H; cin.ignore(); int N; // maximum number of turns before game over. cin >> N; cin.ignore(); int X0; int Y0; cin >> X0 >> Y0; cin.ignore();

// game loop while (1) { string bombDir; // the direction of the bombs from batman's current location (U, UR, R, DR, D, DL, L or UL) cin >> bombDir; cin.ignore();

// Write an action using cout. DON'T FORGET THE "<< endl" // To debug: cerr << "Debug messages..." << endl;

// the location of the next window Batman should jump to. cout << "0 0" << endl; } }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems Second International Conference Acids Hue City Vietnam March 2010 Proceedings Part 1 Lnai 5990

Authors: Manh Thanh Le ,Jerzy Swiatek ,Ngoc Thanh Nguyen

2010th Edition

3642121446, 978-3642121449

More Books

Students also viewed these Databases questions

Question

4. Identify cultural variations in communication style.

Answered: 1 week ago

Question

9. Understand the phenomenon of code switching and interlanguage.

Answered: 1 week ago

Question

8. Explain the difference between translation and interpretation.

Answered: 1 week ago