Showing posts with label SRM 639. Show all posts
Showing posts with label SRM 639. Show all posts

Sunday, November 30, 2014

TopCoder SRM 639

SRM 639 Div. 1 

First Problem:
250 - AliceGame

Solution:
The problem is very mathematical in a sense. First observation: there will always be one winner and one loser in a round. So if we sum up the scores obtained by the two players, we will get the total number of scores accumulated from round 0 to round N consecutively. Hence if the sum of the players score is in the form of \( 2 \sum_{i=0}^{N} {i} - N = N^2 \), for some integer N, then the players have played N rounds, otherwise it is impossible to obtain those scores.