UVA11875 Brick Game【数学Ad Hoc】

There is a village in Bangladesh, where brick game is very popular. Brick game is a team game. Each team consists of odd number of players. Number of players must be greater than 1 but cannot be greater than 10. Age of each player must be within 11 and 20. No two players can have the same age. There is a captain for each team. The communication gap between two players depends on their age difference, i.e. the communication gap is larger if the age difference is larger. Hence they select the captain of a team in such a way so that the number of players in the team who are younger than that captain is equal to the number of players who are older than that captain.
    Ages of all members of the team are provided. You have to determine the age of the captain.
Input
Input starts with an integer T (T ≤ 100), the number of test cases.
    Each of the next T lines will start with an integer N (1 < N < 11), number of team members followed by N space separated integers representing ages of all of the members of a team. Each of these N integers will be between 11 and 20 (inclusive). Note that, ages will be given in strictly increasing order or strictly decreasing order. We will not mention which one is increasing and which one is decreasing, you have to be careful enough to handle both situations.
Output
For each test case, output one line in the format ‘Case x: a’ (quotes for clarity), where x is the case number and a is the age of the captain.
Sample Input
2
5 19 17 16 14 12
5 12 14 16 17 18
Sample Output
Case 1: 16
Case 2: 16

问题链接UVA11875 Brick Game
问题简述:(略)
问题分析
    给定n(奇数)个单调顺序的数,求其中位数。
    简单题不解释。
程序说明:(略)
参考链接:(略)
题记:(略)

AC的C++语言程序如下:

/* UVA11875 Brick Game */

#include <bits/stdc++.h>

using namespace std;

const int N = 11;
int a[N];

int main()
{
    int t, n;
    scanf("%d", &t);
    for(int k = 1; k <= t; k++) {
        scanf("%d", &n);
        for(int i = 0; i < n; i++)
            scanf("%d", &a[i]);

        printf("Case %d: %d\n", k, a[n / 2]);
    }

    return 0;
}
Spring-brick是一种创意的设计结构,它结合了春天和砖块这两个元素。春天代表了新生和希望,而砖块代表着稳固和坚实。Spring-brick的概念是将这两种元素融合在一起创造出一种独特的建筑材料。 这种建筑材料具有很多优点。首先,Spring-brick的设计结构使其在承重方面非常可靠。砖块的坚固性保证了材料的耐用性和稳定性,使得建筑物能够经受住各种天气和环境的考验。其次,春天的元素使Spring-brick具有一种轻盈和活力的感觉。这种设计能够为建筑物带来一种生机和活力,使其融入周围的环境中。 Spring-brick在建筑设计中有着广泛的应用。与传统的砖块相比,Spring-brick的设计结构更加具有创意和独特性,可以为建筑物带来独特的外观和个性化的风格。同时,Spring-brick还具有很高的适用性和可塑性。它可以用于建造各种类型的建筑,包括住宅、商业建筑和公共设施等。 此外,Spring-brick还具有环保和可持续发展的特点。砖块作为一种天然材料,可以循环利用并减少对环境的负面影响。春天的元素也使Spring-brick更加与自然环境融合,并通过绿色建筑的概念,促进可持续发展。 总的来说,Spring-brick是一种创意而实用的建筑材料,其独特的设计结构结合了春天和砖块的元素,使建筑物具有稳固性和轻盈感。它的应用广泛,并符合环保和可持续发展的原则。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值