浙江省第十四次ACM程序竞赛 Let's Chat(D题)
ACM (ACMers'Chatting Messenger) is a famous instant messaging software developed by MarjarTechnology Company. To attract more users, Edward, the boss of Marjar Company,has recently added a new feature to the software. The new feature can bedescribed as follows:
If two users, Aand B, have been sending messages to each other on thelast mconsecutive days, the "friendship point"between them will be increased by 1 point.
More formally, ifuser A sent messages to user B on each day between the (i - m +1)-th day and the i-th day (both inclusive), and user B also sentmessages to user A on each day between the (i - m +1)-th day and the i-th day (also both inclusive), the"friendship point" between A and B will be increased by 1 at the endof the i-th day.
Given the chattinglogs of two users A and B during n consecutive days, what'sthe number of the friendship points between them at the end of the n-thday (given that the initial friendship point between them is 0)?</