The first look at the constraints is very important. A,B<=10^9. Among this there are sqrt(1000000000) almost 32000 numbers which are squares of natural numbers. Initially before processing the input, we need to write out all the full square number and store them somewhere. Then after reading the input, we need to loop over all the numbers and check if they are in the given range or not ( be attentive, we need to loop over the number which we found, and check whether they are in the range or not, not vice versa ).
No comments:
Post a Comment