Electronic Clock
Time limit1sMemory limit1024 MB
Given ten n by m LED digit pictures, find the total number of LED switches over all 1440 minute changes in a day, including the wrap from 23:59 to 00:00.
- Level
Easy3 of 10
- Topics
- Implementation, Simulation
- Solved
- No attempts yet
Problem
Fedya, a young designer, wants to build an electronic clock. The clock shows only the hour and minute of the current time on four displays on its panel. Each display is an rectangle, and each cell of it is an LED. Each digit is drawn on its display as a picture.
Each LED is either on or off. Switching an LED from one state to the other costs 1 joule. Keeping an LED in any state costs no energy, no matter how long it stays there. For example, suppose each display has two LEDs. The digit 1 has the first LED on and the second off, and the digit 2 has the second LED on and the first off. Then changing from 1 to 2 costs 2 joules. If both LEDs are off for the digit 3, changing from 2 to 3 costs 1 joule.
To choose the battery type, Fedya asks you to compute how many joules the panel of his clock uses in one day. The day runs from the change 00:00 to 00:01 through the change 23:59 to 00:00.
Input
The first line contains two positive integers and (). Ten blocks follow, one for each digit from 0 to 9. Each block has lines, and each line has characters. The character # means an LED that is on, and the character . means an LED that is off.
Output
Print the number of joules the panel of the clock uses in one day.