# Problem from the book "Programming Challenges" : 1

Today’s Problem:
Problem Number: 2.8.3
Title: Hartal
Info: PC/UVa IDs: 110203/10050, Popularity: B, Success rate: high Level: 2

Description:  Political parties in Bangladesh show their muscle by calling for regular hartals(strikes), which cause considerable economic damage. For our purposes, each party may be characterized by a positive integer h called the hartal parameter that denotes the average number of days between two successive strikes called by the given party. Consider three political parties. Assume h1 = 3, h2 = 4, and h3 = 8, where hi is the hartal parameter for party i. We can simulate the behavior of these three parties for N = 14 days. We always start the simulation on a Sunday. There are no hartals on either Fridays or Saturdays.

 Days 1 2 3 4 5 6 7 8 9 10 11 12 13 14 Su Mo Tu We Th Fr Sa Su Mo Tu We Th Fr Sa Party 1 x x x x Party 2 x x x Party 3 x Hartals 1 2 3 4 5

There will be exactly five hartals (on days 3, 4, 8, 9, and 12) over the 14 days. There is no hartal on day 6 since it falls on Friday. Hence we lose five working days in two weeks. Given the hartal parameters for several political parties and the value of N, determine the number of working days lost in those N days.

Input:    Input will be in the following form
14 3 3,4,8

1st number means the total number of days to go through
2nd number means the number of political parties
3rd comma separated string means hartal sequence for each party.

Output: output the number of working days lost

In this case, output will be 5

_______________________________

### Solution - Problem from the book "Programming Challenges" : 1

JOIN THE COMMUNITY

Never Miss What"s New !

No SPAM, only email notification if new posts were published.