| Time Limit: 1000MS | Memory Limit: 65536K | |
| Total Submissions: 31702 | Accepted: 10813 |
Description
Background
The knight is getting bZ??http://www.2cto.com/kf/ware/vc/" target="_blank" class="keylink">vcmVkIG9mIHNlZWluZyB0aGUgc2FtZSBibGFjayBhbmQgd2hpdGUgc3F1YXJlcyBhZ2FpbiBhbmQgYWdhaW4gYW5kIGhhcyBkZWNpZGVkIHRvIG1ha2UgYSBqb3VybmV5IDxicj4KYXJvdW5kIHRoZSB3b3JsZC4gV2hlbmV2ZXIgYSBrbmlnaHQgbW92ZXMsIGl0IGlzIHR3byBzcXVhcmVzIGluIG9uZSBkaXJlY3Rpb24gYW5kIG9uZSBzcXVhcmUgcGVycGVuZGljdWxhciB0byB0aGlzLiBUaGUgd29ybGQgb2YgYSBrbmlnaHQgaXMgdGhlIGNoZXNzYm9hcmQgaGUgaXMgbGl2aW5nIG9uLiBPdXIga25pZ2h0IGxpdmVzIG9uIGEgY2hlc3Nib2FyZCB0aGF0IGhhcyBhIHNtYWxsZXIgYXJlYSB0aGFuIGEgcmVndWxhciA4ICogOCBib2FyZCwKIGJ1dCBpdCBpcyBzdGlsbCByZWN0YW5ndWxhci4gQ2FuIHlvdSBoZWxwIHRoaXMgYWR2ZW50dXJvdXMga25pZ2h0IHRvIG1ha2UgdHJhdmVsIHBsYW5zPyA8YnI+Cjxicj4KPHN0cm9uZz5Qcm9ibGVtPC9zdHJvbmc+IDxicj4KRmluZCBhIHBhdGggc3VjaCB0aGF0IHRoZSBrbmlnaHQgdmlzaXRzIGV2ZXJ5IHNxdWFyZSBvbmNlLiBUaGUga25pZ2h0IGNhbiBzdGFydCBhbmQgZW5kIG9uIGFueSBzcXVhcmUgb2YgdGhlIGJvYXJkLgo8cCBjbGFzcz0="pst">Input The input begins with a positive integer n in the first line. The following lines contain n test cases. Each test case consists of a single line with two positive integers p and q, such that 1 <= p * q <= 26. This represents a p * q chessboard, where p describes how many different square numbers 1, . . . , p exist, q describes how many different square letters exist. These are the first q letters of the Latin alphabet: A, . . .
Output
If no such path exist, you should output impossible on a single line.
Sample Input
3 1 1 2 3 4 3
Sample Output
Scenario #1: A1 Scenario #2: impossible Scenario #3: A1B3C1A2B4C2A3B1C3A4B2C4
题意:国际象棋,然后给一个马(马走日) ,可以从任意点出发,找一条可以访问所有格子(p*q的棋盘)的路径,注意路径如果有多条要求输出字典序最小的那条。。然后这个可以搜索的时候按字典序搜。。就是搜索方向要固定。。不能随意写了
然后其他的没什么了 直接深搜,搜到答案之后直接return ;
#include#include #include #include #include #include #include #include #include #include #include #include