CF1925B A Balanced Problemset?

题目描述

**题意简述** 有一个序列,已知其和为 $X$,长度为 $N$,求这个序列最大的最大公因数。

输入格式

第一行有一个整数 $T$($1\le T\le 10^3$),有 $T$ 组数据。 接下来 $T$ 行,每行两个整数,分别为 $X,N$($1\le x\le 10^8, 1\le n\le x$)。

输出格式

每组数据输出一行,表示可能的最大公因数。

说明/提示

For the first test case, one possible way is to break up the problem of difficulty $ 10 $ into a problemset having three problems of difficulties $ 4 $ , $ 2 $ and $ 4 $ respectively, giving a balance equal to $ 2 $ . For the second test case, there is only one way to break up the problem of difficulty $ 5 $ into a problemset of $ 5 $ problems with each problem having a difficulty $ 1 $ giving a balance equal to $ 1 $ .