Posted on 2009-03-23 20:04
Hero 閱讀(72)
評論(0) 編輯 收藏 引用 所屬分類:
代碼如詩--ACM
1 //1120 Accepted 31 196 463 C++
2
3 #include <iostream>
4 #include <string>
5 using namespace std ;
6
7 int tnum ;
8 int inn ;
9
10 int main()
11 {
12 while( scanf( "%d", &tnum ) != EOF )
13 {
14 while( tnum -- )
15 {
16 scanf( "%d", &inn ) ; char ch = getchar() ;
17 string str ;
18 int cnt = 0 ;
19 while( true )
20 {
21 cin >> str ; ch = getchar() ;
22 int len = str.length() ;
23 if( len == inn ) cnt++ ;
24 if( ch == '\n' ) break ;
25 }
26
27 cout << cnt << endl ;
28 }
29 }
30 return 0 ;
31 }