CF1476A.K-divisible Sum
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given two integers n and k .
You should create an array of n positive integers a1,a2,…,an such that the sum (a1+a2+⋯+an) is divisible by k and maximum element in a is minimum possible.
What is the minimum possible maximum element in a ?
输入格式
The first line contains a single integer t ( 1≤t≤1000 ) — the number of test cases.
The first and only line of each test case contains two integers n and k ( 1≤n≤109 ; 1≤k≤109 ).
输出格式
For each test case, print one integer — the minimum possible maximum element in array a such that the sum (a1+⋯+an) is divisible by k .
输入输出样例
输入#1
4 1 5 4 3 8 8 8 17
输出#1
5 2 1 3
说明/提示
In the first test case n=1 , so the array consists of one element a1 and if we make a1=5 it will be divisible by k=5 and the minimum possible.
In the second test case, we can create array a=[1,2,1,2] . The sum is divisible by k=3 and the maximum is equal to 2 .
In the third test case, we can create array a=[1,1,1,1,1,1,1,1] . The sum is divisible by k=8 and the maximum is equal to 1 .