Grand Opening

시간 제한1초메모리 제한2048 MB

요약
n개의 격자 모양 자물쇠와 열쇠 하나가 주어질 때, 모든 칸이 어긋나지 않고 맞는 자물쇠의 개수를 센다.
난이도

쉬움10점 중 3점

유형
구현, 행렬, 완전 탐색
정답자
아직 제출이 없습니다

문제

Working at a lock recycling company can be a pain, especially when the locks need to be unlocked and reusable and people forgot to turn in their keys. A friend that works at such a company has found a solution to this problem: a bump key. Your friend has a list of specifications for the tumblers in each lock, and needs your help. You are tasked with finding out which locks he should attempt to open using a bump key, and which locks are for the furnace.

The key and locks are made of the character "#", and the rest is indicated by a dot. In the example below, you can see that the key on the left doesn't fit the lock on the right. The parts where the key doesn't fit are marked with a "■".

입력

  • A line with three space-separated integers nn ww and hh (1≤n≤1000,1≤w,h≤100)(1 \leq n\leq 1000, 1 \leq w,h \leq 100), indicating the number of locks, and the width and height of the key and locks.
  • nn locks, where each lock consists of hh lines of ww characters "#" or ".".
  • hh lines of ww character "#" or ".", representing the key.

출력

A single integer, the number of locks the given key fits in.

예제2

  1. 예제 1

    입력
    1 20 5
    ....................
    ....................
    ....................
    ####################
    ....................
    ....................
    ....................
    ....................
    ####################
    ....................
    
    예상 출력
    0
    
  2. 예제 2

    입력
    3 20 5
    ....................
    ...................#
    ..................##
    ....###..##..##.####
    ####################
    ....................
    ...................#
    ..........#........#
    ....###..##..##.#..#
    ####################
    ....................
    ...................#
    ..##...............#
    ..#####..##..##.#..#
    ####################
    ####################
    .....###...########.
    ......#.....###..#..
    ....................
    ....................
    
    예상 출력
    1