10274_OddorEven

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

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

Pro.ID

10274

Title

Odd or Even

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    There are several versions of Odd or Even, a game played by competitors to decide random issues (such as "who will code this problem?"). In one of the versions, for two players, the game starts with each player calling either odds or evens. Then they count to three (some people chant "Once, twice, three, SHOOT!"). On three, both players hold out one of their hands, showing a number of fingers (from zero to five). If the fingers add to an even number, then the person who called evens wins. If the fingers add to an odd number, then the person who called odds wins.

    John and Mary played several games of Odd or Even. In every game John chose odds (and, consequently, Mary chose evens). During the games each player wrote down, in small cards, how many fingers he/she showed, using one card for each game – Mary used blue cards, John used red cards. Their objective was to be able to re-check the results later, looking at the cards for each game. However, at the end of the day John dropped the deck of cards, and although they could separate the cards by color, they are now out of order.

    Given the set of numbers written on red cards and on blue cards, you must write a program to determine the minimum number of games that Mary certainly won.

    输入

    The input contains several test cases. The first line of a test case contains an integer N representing the number of games played ( 1 N 100 ). The second line of a test case contains N integers Xi, indicating the number of fingers shown by Mary in each of the games ( 0 Xi 5, for 1 i N ). The third line of a test case contains N integers Yi, indicating the number of fingers shown by John in each of the games ( 0 Yi 5, for 1  i ≤ N ). The end of input is indicated by N = 0.

    输出

    Description

    There are several versions of Odd or Even, a game played by competitors to decide random issues (such as "who will code this problem?"). In one of the versions, for two players, the game starts with each player calling either odds or evens. Then they count to three (some people chant "Once, twice, three, SHOOT!"). On three, both players hold out one of their hands, showing a number of fingers (from zero to five). If the fingers add to an even number, then the person who called evens wins. If the fingers add to an odd number, then the person who called odds wins.

    John and Mary played several games of Odd or Even. In every game John chose odds (and, consequently, Mary chose evens). During the games each player wrote down, in small cards, how many fingers he/she showed, using one card for each game – Mary used blue cards, John used red cards. Their objective was to be able to re-check the results later, looking at the cards for each game. However, at the end of the day John dropped the deck of cards, and although they could separate the cards by color, they are now out of order.

    Given the set of numbers written on red cards and on blue cards, you must write a program to determine the minimum number of games that Mary certainly won.

    Input

    The input contains several test cases. The first line of a test case contains an integer N representing the number of games played ( 1 N 100 ). The second line of a test case contains N integers Xi, indicating the number of fingers shown by Mary in each of the games ( 0 Xi 5, for 1 i N ). The third line of a test case contains N integers Yi, indicating the number of fingers shown by John in each of the games ( 0 Yi 5, for 1  i ≤ N ). The end of input is indicated by N = 0.

    Output

    For each test case your program must write one line, containing one integer, indicating the minimum number of games that Mary certainly won.

    Sample Input

    3
    1 0 4
    3 1 2
    9
    0 2 2 4 2 1 2 0 4
    1 2 3 4 5 0 1 2 3
    0

    Sample Output

    0
    3

    Source

    样例输入

    3
    1 0 4
    3 1 2
    9
    0 2 2 4 2 1 2 0 4
    1 2 3 4 5 0 1 2 3
    0

    样例输出

    0
    3

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部