### amit5148's blog

By amit5148, 9 years ago, ,
Problem A
Iterate over all possible pairs of soldiers and count those having difference of their heights less than or equal to d.

Problem B
Replace all occurrences of '--' with '2', '-.' with '1' and '.' with '0'.
Initially, there was some problem with the test cases but was rectified soon.

Problem C
I won't be discussing my approach to this problem as my solution was hacked :( and I haven't tried another approach yet.
Earlier I thought that my code failed because I was using int for storing answer,but later found that its giving WA after changing it to long.

Problem D
Simple approach was to start finding stars in order of their indexes.
For this, first try for stars with smaller radius, then for top and finally for left.
Following code may explain it further.

for(x=radius; k>0 && x < N-r;++x)
for(y=radius; k>0 && y < N-r;++y)
k--;
if(k==0)
else
//display -1

Problem E
Haven't yet solved this problem too. Will be updating soon.

This was my second contest at Codeforces. I was able to solve more problems this time and enter div 1, so enjoyed it :)