I have an array like {3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8} where every integer represents a percentage. The target sum of the numbers ought to be 100 % but since they have been rounded off to the nearest whole number (.5 rounds up) it is possible that the sum may not be 100. I need to know whether the actual values before rounding can sum to 100%

What I tried: I figured that a value in the array can either be the result of rounding up in which case the original would be less 0.5 or the value can be the result of rounding down in which case the original would be more 0.4. So I tried this, knowing the difference (e.g from example above) to be 7, is there some combination of X*(-0.5) + Y*0.4 where X and Y are constants, whose sum = count the length of the array, that would give me a difference of 7? This strategy worked for some test cases for example {12,12,12,12,12,12,12,12} and {13,13,13,13,13,13,13,13} but not this one yet according to the answers this array can be made to have a target sum of 100% so my function should return true.

Here is the code I tried.

```
Boolean combination(int difference, int count)
{
decimal d;
for (int x = 0; x <= count;x++)
{
for(int y=0; y<=count-x;y++)
{
d = (x * (decimal)(-0.5)) + (y * (decimal)(0.4));
if ( d == difference)
return true;
}
}
return false;
}
```

Original practice question, from topcoder.com SRM 544 DIV 2; success rate < 20% from > 700 submissions. guess it was a tricky question :)

In a normal election, one expects the percentages received by each of the candidates to sum to exactly 100 percent. There are two ways this might not be the case: if the election is fraudulent, or if the reported percentages are rounded. In a recent election, the number of voters was known to be exactly 10000. Assuming the election was run fairly, each voter voted for exactly one candidate. The percentage of the vote received by each candidate was rounded to the nearest whole number before being reported. Percentages lying halfway between two consecutive whole numbers were rounded up. The ministry of voting is looking for a proof of election fraud. You'll be given a int[] percentages, giving the reported percentage of the vote that went to each candidate. Return a string containing "YES" if the election is definitely fraudulent, otherwise return "NO" (quotes for clarity only). That is, return "YES" if it could not be the case that each of the 10000 voters voted for exactly one candidate, and "NO" otherwise.

appreciate any help me with this. Please don't post answers to this all I ask for is a new train of thought that I may not have considered.