22120_AliceandBob

2022-5-16 18:21| 发布者: Hocassian| 查看: 22| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506125160999-Problem List-采集的数据-后羿采集器.html

Pro.ID

22120

Title

Alice and Bob

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22120

AC

0

Submit

5

Ratio

0.00%

时间&空间限制

  • Time Limit: 3000/1000 MS (Java/Others)     Memory Limit: 131072/65536 K (Java/Others)
  • 描述

    Alice is a beautiful and clever girl. Bob would like to play with Alice.

    One day, Alice got a very big rectangle and wanted to divide it into small square pieces. Now comes a problem: if all pieces of small squares are of the same size, how big could the squares be? To Alice, it’s easy to solve the problem. However, she was very busy, so she asked Bob to help her. You know Alice is such a lovely girl and of course Bob won’t refuse her request. But Bob is not so smart and he is especially weak in math. So he turns to you — a genius at programming.

    Alice will inform Bob the length and width of the big rectangle, and Bob have to tell her the longest length for the small square. All of these numbers are in their binary representations.

    输入

    The first line of the input is a positive integer. This is the number of the test cases followed. Each test case contains two integer L and W in their binary representation which tells you the length and width of the very big rectangle ( 0 < L, W < 21000 ). There may be one or several spaces between these integers.

    输出

    Description

    Alice is a beautiful and clever girl. Bob would like to play with Alice.

    One day, Alice got a very big rectangle and wanted to divide it into small square pieces. Now comes a problem: if all pieces of small squares are of the same size, how big could the squares be? To Alice, it’s easy to solve the problem. However, she was very busy, so she asked Bob to help her. You know Alice is such a lovely girl and of course Bob won’t refuse her request. But Bob is not so smart and he is especially weak in math. So he turns to you — a genius at programming.

    Alice will inform Bob the length and width of the big rectangle, and Bob have to tell her the longest length for the small square. All of these numbers are in their binary representations.

    Input

    The first line of the input is a positive integer. This is the number of the test cases followed. Each test case contains two integer L and W in their binary representation which tells you the length and width of the very big rectangle ( 0 < L, W < 21000 ). There may be one or several spaces between these integers.

    Output
    The output of the program should consist of one line of output for each test case. The output of each test case only contains the longest length for the small squares in its binary representation. No any redundant spaces are needed.
    Sample Input
    2
    100 1000
    100 110
    Sample Output
    100
    10
    Source

    样例输入

    2
    100 1000
    100 110

    样例输出

    100
    10

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部