GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Sunday 16 October 2022

[Solution] Divisible Numbers (easy version) Codeforces Solution



E1. Divisible Numbers (easy version)
time limit per test
4 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

This is an easy version of the problem. The only difference between an easy and a hard version is the constraints on abc and d.

You are given 4 positive integers abcd with a<c and b<d. Find any pair of numbers x and y that satisfies the following conditions:

  • a<xcb<yd,
  • xy is divisible by ab.

Note that required x and y may not exist.

Input

The first line of the input contains a single integer t (1t10), the number of test cases.

Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

The descriptions of the test cases follow.

The only line of each test case contains four integers abc and d (1a<c1051b<d105).

Output

For each test case print a pair of numbers a<xc and b<yd such that xy is divisible by ab. If there are multiple answers, print any of them. If there is no such pair of numbers, then print -1 -1.


No comments:

Post a Comment