mirror of
https://github.com/wczffl-503/OI-Codes.git
synced 2025-07-08 02:13:51 +08:00
Add FZOI Codes
This commit is contained in:
45
FZOI/[USACO08OPEN] Word Power S 0 天 08-20-24.cpp
Normal file
45
FZOI/[USACO08OPEN] Word Power S 0 天 08-20-24.cpp
Normal file
@ -0,0 +1,45 @@
|
||||
#include<iostream>
|
||||
using namespace std;
|
||||
|
||||
int n, m, tot[1001];
|
||||
string nx[1001], en[101];
|
||||
|
||||
int f(string nn,string ee)
|
||||
{
|
||||
int now = -1;
|
||||
string::size_type po = 0;
|
||||
for(int i = 0; i < ee.size(); i++)
|
||||
{
|
||||
po = nn.find(ee[i], now+1);
|
||||
if(po == nn.npos)return 0;
|
||||
now = po;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
cin >> n >> m;
|
||||
for(int i = 1; i <= n; i ++ )
|
||||
{
|
||||
cin >> nx[i];
|
||||
for(int j = 0; j < nx[i].size(); j ++ )
|
||||
{
|
||||
if(nx[i][j] > 96) nx[i][j] -= 32;
|
||||
}
|
||||
}
|
||||
for(int i = 1; i <= m; i ++ )
|
||||
{
|
||||
cin >> en[i];
|
||||
for(int j = 0; j < en[i].size(); j ++ )
|
||||
{
|
||||
if(en[i][j] > 96) en[i][j] -= 32;
|
||||
}
|
||||
|
||||
for(int j = 1; j <= n; j ++ )
|
||||
{
|
||||
if(f(nx[j], en[i])) tot[j] ++ ;
|
||||
}
|
||||
}
|
||||
for(int i = 1; i <= n; i ++ ) cout << tot[i] << endl;
|
||||
}
|
Reference in New Issue
Block a user