Tuesday, November 25, 2014

SRM 635 div 2 500

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