توجه: سوال‌ها لزوما به ترتیب سختی مرتب نشده‌اند و ترتیب آن‌ها (تقریبا!) اتفاقی است. استفاده از منابع از پیش آماده شده و دیکشنری‌ها در حین مسابقه مجاز است.

برای سرعت بیشتر برنامه‌ها، بجای پایتون می‌توانید با PyPy کدتان را ارسال کنید.

لینک‌های مفید برای شرکت در مسابقه:

می‌توانید سوال‌های خود را از بخش "سوال بپرسید" مطرح کنید.

Parquet (2020)


  • Memory Limit: 256MB
  • Time Limit: 1sec

Pari has set up a new parquet flooring for her room. Her room is WW meters wide and LL meters long.

The blocks are of quadratic shape and each has an area of one quadratic meter. Once Pari had set up the flooring, which consists of yellow-colored blocks, she decided to paint the blocks on the edge of the room black.

توضیح

The picture above illustrates the floor from the test case #2 – outer blocks are black, while the remaining two inner blocks are yellow.

Mari has come to visit Pari. While Pari was serving her biscuits, she counted the number of blocks of each color. When Mary returned home, she recalled of the two numbers and wished to calculate the dimensions of Pari’s room. Help her!

Input🔗

The first and only line of input contains two integers separated by a space, RR (the number of black blocks) and BB (the number of yellow blocks).

8R50008 \le R \le 5000 1B2 000 0001 \le B \le 2\ 000\ 000

Output🔗

The first and only line of output must contain the dimensions of Pari's room, LL and WW, respectively. If the numbers differ, output the bigger one first. The test data is designed to somehow ensure that a unique solution always exists.

Sample Input 1🔗

8 1
Plain text

Sample Output 1🔗

3 3
Plain text

Sample Input 2🔗

10 2
Plain text

Sample Output 2🔗

4 3
Plain text

Sample Input 3🔗

24 24
Plain text

Sample Output 3🔗

8 6
Plain text
ارسال پاسخ برای این سؤال
در حال حاضر شما دسترسی ندارید.