我希望你是我独家记忆

一段永远封存的记忆,随风而去
posts - 263, comments - 31, trackbacks - 0, articles - 3
   :: 首页 :: 新随笔 ::  :: 聚合  :: 管理

HLOJ_1223

Posted on 2009-06-03 14:04 Hero 阅读(47) 评论(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     forint i=1; i<=inn; i++ )
18     {
19         scanf( "%s", hero[i] ) ;
20     }
21 
22     scanf( "%d"&inm ) ;
23     forint i=1; i<=inm; i++ )
24     {
25         scanf( "%s", hero[0] ) ;
26 
27         bool ishero = false ;
28         forint 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 }

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理