All Tracks Math Problem

"MONTY MONTY MONTY"
Tag(s):

Easy

Problem
Editorial
Analytics

Disha Mohanty, popularly known as Monty, is fed up of her nick name. She recently changed her branch to CSE with high hopes that her new friends wouldn't know about her nickname. Unfortunately for her, word got around, and all her new classmates started calling her "Monty". In order to prove her intelligence and stop people from calling her by her nickname, she gave the people an offer they couldn't refuse. If anyone of them is able to solve the question faster than she did, they can keep calling her Monty forever, or else they would stop. Rishabh, popluarly known as Pincha, a guy who loves dark humor and is a top-notch prankster, doesn't want that to happen. Help him solve it as fast as possible.

In a class, N students have to be seated such that each row has the same number of students as the others. If at least X students are to be seated per row and at least X rows have to be there, then how many arrangements are possible?

Input format :

First line of each input contains T (number of testcases ) then T lines follows : each containing N and X separated by a space.

Output format :

Print number of possible arrangements in a new line.

Constraints :

1 <= T <= 10^5
1 <= N <= 10^6
1 <= X < N

SAMPLE INPUT
1
48 3
SAMPLE OUTPUT
6
Explanation

Number of testcase is 1 . where total number of students are 48 and atleast 3 students should sit together and atleast 3 rows should be there. So , possible arrangements are like : (no. of rows , no. of students per row) : (3,16) , (4,12) , (6,8) , (8,6) , (12,4) , (16,3) so output is 6 .

Time Limit: 1.0 sec(s) for each input file.
Memory Limit: 256 MB
Source Limit: 1024 KB
Marking Scheme: Marks are awarded when all the testcases pass.
Allowed Languages: C, C++, C++14, Clojure, C#, D, Erlang, F#, Go, Groovy, Haskell, Java, Java 8, JavaScript(Rhino), JavaScript(Node.js), Julia, Lisp, Lisp (SBCL), Lua, Objective-C, OCaml, Octave, Pascal, Perl, PHP, Python, Python 3, R(RScript), Racket, Ruby, Rust, Scala, Swift, Visual Basic, Kotlin

CODE EDITOR

Initializing Code Editor...
Your Rating:

Contributor

Notifications
View All Notifications