CF1085B Div Times Mod

题目描述

给定n,k(1≤n≤$10^6$,2≤k≤$10^3$) 已知i,ans $\in$ Z,S.T. i | n(1≤i)&&ans $\equiv$ i(mod k)&&ans / k == n / i 求ans的最小值

输入格式

一行,分别为n,k

输出格式

一行,ans ## 输入输出样例 样例搬运过来就行了

说明/提示

The result of integer division $ a~\mathrm{div}~b $ is equal to the largest integer $ c $ such that $ b \cdot c \leq a $ . $ a $ modulo $ b $ (shortened $ a \bmod b $ ) is the only integer $ c $ such that $ 0 \leq c < b $ , and $ a - c $ is divisible by $ b $ . In the first sample, $ 11~\mathrm{div}~3 = 3 $ and $ 11 \bmod 3 = 2 $ . Since $ 3 \cdot 2 = 6 $ , then $ x = 11 $ is a solution to $ (x~\mathrm{div}~3) \cdot (x \bmod 3) = 6 $ . One can see that $ 19 $ is the only other positive integer solution, hence $ 11 $ is the smallest one.