Iterating over Floors

Posted on Jul 1, 2020

830C-Bamboo Partition
It turns out the possible values of $answer$ is of the type $\lfloor\frac{x}{y}\rfloor$, and we need some way to iterate through these values which are $O(\sqrt{n})$. This can be done with some neat trick.

for(LL i = 1; i <= K; i++){
	LL possible = (K/i);
	i = K/possible; 
}