|
|
back to boardA little hint Amount of rectangles is equal to the number of divisiors of tiles count wich are no more than Square_Root(tiles count). So the part of code solving this problem may be the following: For L:=1 To 10000-K Do Begin DivisiorsCount:=1; For J:=2 To Trunc(Sqrt(L)) Do If L Mod J=0 Then Inc(DivisiorsCount); If DivisiorsCount=M Then Begin DivisiorsCount2:=1; For J:=2 To Trunc(Sqrt(L+K)) Do If (L+K) Mod J=0 Then Inc(DivisiorsCount2); If DivisiorsCount2=N Then Begin SoulutionExists:=True; Break; End; End; End; You should output L+K if SolutionExists, 0 - otherwise. |
|
|