OpenJudge

02:Dangerous Packet

总时间限制:
1000ms
内存限制:
65536kB
描述

The security of computer systems has become a major issue nowadays. Trojans, worms and viruses spread so quickly via the Internet, posing a significant risk to any systems running on the network. Fortunately, we may have powerful Intrusion Detection Systems (IDS) to block these malicious packets from the chaos Internet so that they cannot infect our local machines. An IDS stands between the external network and the internal network, and scans every packet it receives from the external network. If it detects some dangerous data in a packet, it will drop it. Otherwise it lets it through to the destination local machine. Typically the IDS is knowledge based, that is, it maintains a database of the patterns of dangerous packets. For example, if the packet data contains 57724C6568004577A, it is likely a buffer overflow attack on a computer running Server Message Block Service. The IDS must work fast enough or the network transit will get stuck. Given one dangerous pattern and one packet, can you efficiently check if the pattern is present in the packet?

输入
The input begins with the number of test cases T (T<=100).
Each test case has two lines of binary data written in hex numbers. The first line represents a dangerous pattern and the second line represents a packet. All the hex letters are upper-case. The size of any binary data (pattern or packet) will not exceed 65536 bytes.
输出
For each case, if the packet contains the dangerous pattern, output "Yes" along with the first occurrence position of the pattern (index starts from 0). Otherwise output "No".
样例输入
2
57724C6568004577A
A00257724C6568004577A622231FFAB
700A521B
62CE521B4C3700A90C21DB15A2
样例输出
Yes 4
No
全局题号
5930
添加于
2017-08-29
提交次数
10
尝试人数
2
通过人数
0