CF1603D.Artistic Partition
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
For two positive integers l and r ( l≤r ) let c(l,r) denote the number of integer pairs (i,j) such that l≤i≤j≤r and gcd(i,j)≥l . Here, gcd(i,j) is the greatest common divisor (GCD) of integers i and j .
YouKn0wWho has two integers n and k where 1≤k≤n . Let f(n,k) denote the minimum of i=1∑kc(xi+1,xi+1) over all integer sequences 0=x1<x2<…<xk<xk+1=n .
Help YouKn0wWho find f(n,k) .
输入格式
The first line contains a single integer t ( 1≤t≤3⋅105 ) — the number of test cases.
The first and only line of each test case contains two integers n and k ( 1≤k≤n≤105 ).
输出格式
For each test case, print a single integer — f(n,k) .
输入输出样例
输入#1
4 6 2 4 4 3 1 10 3
输出#1
8 4 6 11
说明/提示
In the first test case, YouKn0wWho can select the sequence [0,2,6] . So f(6,2)=c(1,2)+c(3,6)=3+5=8 which is the minimum possible.