CF984A Game

    • 88通过
    • 180提交
  • 题目来源 CodeForces 984A
  • 评测方式 RemoteJudge
  • 标签 排序 模拟
  • 难度 入门难度
  • 时空限制 2000ms / 256MB

题解

  • 提示:收藏到任务计划后,可在首页查看。
  • 最新讨论 显示

    推荐的相关题目 显示

    题意翻译

    两个人玩游戏,游戏规则是:

    写在黑板上的n个数字。每个回合一个玩家选择一个数字并从黑板上删除它。这一直持续到板上只剩下一个数字。第一个玩家先删除,然后第二个玩家删除。 第一个玩家想要留在棋盘上的最后一个数字最小,而第二个玩家想要最大。 请问最后留在这个黑板上的数字是什么?

    感谢@something 提供的翻译

    题目描述

    Two players play a game.

    Initially there are $ n $ integers $ a_1, a_2, \ldots, a_n $ written on the board. Each turn a player selects one number and erases it from the board. This continues until there is only one number left on the board, i. e. $ n - 1 $ turns are made. The first player makes the first move, then players alternate turns.

    The first player wants to minimize the last number that would be left on the board, while the second player wants to maximize it.

    You want to know what number will be left on the board after $ n - 1 $ turns if both players make optimal moves.

    输入输出格式

    输入格式:

    The first line contains one integer $ n $ ( $ 1 \le n \le 1000 $ ) — the number of numbers on the board.

    The second line contains $ n $ integers $ a_1, a_2, \ldots, a_n $ ( $ 1 \le a_i \le 10^6 $ ).

    输出格式:

    Print one number that will be left on the board.

    输入输出样例

    输入样例#1: 复制
    3
    2 1 3
    
    输出样例#1: 复制
    2
    输入样例#2: 复制
    3
    2 2 2
    
    输出样例#2: 复制
    2

    说明

    In the first sample, the first player erases $ 3 $ and the second erases $ 1 $ . $ 2 $ is left on the board.

    In the second sample, $ 2 $ is left on the board regardless of the actions of the players.

    提示
    标程仅供做题后或实在无思路时参考。
    请自觉、自律地使用该功能并请对自己的学习负责。
    如果发现恶意抄袭标程,将按照I类违反进行处理。