Pagini recente » Cod sursa (job #1546266) | Cod sursa (job #1178050) | Cod sursa (job #1008953) | Cod sursa (job #622968) | Cod sursa (job #1031476)
#include <cstdio>
#include <vector>
#include <queue>
#include <cstring>
using namespace std;
#define WTF 276997
int res=0;
char text[277000][20];
void run()
{
}
bool fc(char c)
{
int x = c - '0';
if(x%2==0) return 1;
if(x==5) return 1;
return 0;
}
bool fc2(char a,char b)
{
int x = a - '0';
int y = b - '0';
if((x*10+y)%3==0) return 1;
return 0;
}
bool fc3(char *s,size_t l)
{
for(size_t i=0;i<WTF;++i)
if(strcmp(s,text[i])==0) return 1;
return 0;
}
int main()
{
freopen("dtcsu.in","r",stdin);
freopen("dtcsu.out","w",stdout);
//int n=WTF;
for(size_t i=0;i<WTF;++i)
gets(text[i]);
int n;
char s[20];
scanf("%d",&n);
while(n--)
{
gets(s);
size_t l = strlen(s);
if( fc( s[l-1]) ) ++res;
else if( fc2( s[l-2],s[l-1]) ) ++res;
else if( fc3(s,l) ) ++res;
}
printf("%d",res);
return 0;
}