Thursday, October 2, 2014

ACM 1581. Teamwork / Работа в команде

Keep an element cur which will show the number of elements which equal to the current element, initially it is equal to 1. Then loop over the array, if Ith and I+1 th elements are equal then increase the value of cur by 1 and move on. If they are not equal than add to the answer sequence the pair(cur, A[I]) and turn cur back to 1.


       FULL SOURCE CODE

No comments:

Post a Comment