Posted on 2009-06-03 14:04
Hero 阅读(52)
评论(0) 编辑 收藏 引用 所属分类:
代码如诗--ACM
1 //1223 Accepted 0 184 633 C++
2
3 //字符串查找
4
5 #include <stdio.h>
6 #include <string.h>
7 #include <stdlib.h>
8
9 const int size = 100 ;
10 char hero[size][55] ;
11
12 int inn, inm ;
13
14 int main()
15 {
16 scanf( "%d", &inn ) ;
17 for( int i=1; i<=inn; i++ )
18 {
19 scanf( "%s", hero[i] ) ;
20 }
21
22 scanf( "%d", &inm ) ;
23 for( int i=1; i<=inm; i++ )
24 {
25 scanf( "%s", hero[0] ) ;
26
27 bool ishero = false ;
28 for( int j=1; j<=inn; j++ )
29 {
30 if( NULL != strstr( hero[0], hero[j] ) )
31 {
32 ishero= true ;
33 break ;
34 }
35 }
36 if( ishero )
37 {
38 printf( "A new hero discovered\n" ) ;
39 }
40 else
41 {
42 printf( "Just an ordinary person\n" ) ;
43 }
44 }
45
46 return 0 ;
47 }