回分類題庫
d196: CP Lab Exercise: BBS Struct
出處:

Difficulity : N/A
Accepted : 46 Times | Submit :140 Times | Clicks : 1373
Accepted : 40 Users | Submit : 40 Users | Accepted rate : 100%
Time Limit :10000 ms | Memory Limit : 64000 KBytes
題目加入時間 : 2010-12-15 15:42

Content :

A BBS System has a lot of users. As a admin of the station, we need to search those who has special permissions to secure the system.

You are asked to write a simple program to get the user data and do some simple search.

For the first exercise, we practice using struct.
 

Input :

There are couple sets of data.
For each set of data, The first line is an integer n, indicates that n users to be entered. (0 <= n <= 50)
The following n lines are the user data, each line is compose of two strings "id" and "permissions" (length == 8)
Permissions is composed of A~H or –
AB-D-FGH means no permission of C and E.
After entering the user data, there are some lines of queries. Each queries is a char (A~H or 0), 0 means the search is over.

Output :

For each queries, if there is any user has that permission then output a line with the syntax "s1 s2", which s1 is the user id and s2 is the permissions.

If there is more than one users has the permissions, output all of them according to the input order.

Sample Input :

5
GW ABCDEFGH
ku -B-D-F-H
kaihsyn -------H
pandia AB------
morris --C-----
C
B
H
0
3
GW ABCDEFGH
ku ---D----
pandia --------
C
B
H
0

Sample Output :

GW ABCDEFGH
morris --C-----
GW ABCDEFGH
ku -B-D-F-H
pandia AB------
GW ABCDEFGH
ku -B-D-F-H
kaihsyn -------H
GW ABCDEFGH
GW ABCDEFGH
GW ABCDEFGH

Hint :


  

Author :


  Solve it!   Status Forum (0)

C++
C
JAVA
沒有解題記錄 28445. cp99703008 (2 ms , 220KB)
28375. cp99703017 (2 ms , 218KB)
28304. cp99703006 (2 ms , 212KB)
28262. cp99703015 (2 ms , 230KB)
27949. cp98207405 (2 ms , 240KB)
55085. nwgs524513cja (100 ms , 172KB)

執行時間會受很多因素影響因此僅供參考,主機等級請看這裡