My Blog List

Tuesday, November 25, 2014

SRM 635 DIV 2 250 problem in topcoder

This is somehow easy comparing to other 500 point problem.

this is about a square root.




public class QuadraticLaw {

 public long getTime(long time){
  long number  = (long)Math.floor(Math.sqrt(time));
  for(long i=number; i>0; i--){
   if((i * i) + i <=  time){
    return i;
   }
  }
  return 0l;
 }
}

No comments:

Post a Comment