CF768A.Oath of the Night's Watch

入门

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

"Night gathers, and now my watch begins. It shall not end until my death. I shall take no wife, hold no lands, father no children. I shall wear no crowns and win no glory. I shall live and die at my post. I am the sword in the darkness. I am the watcher on the walls. I am the shield that guards the realms of men. I pledge my life and honor to the Night's Watch, for this night and all the nights to come." — The Night's Watch oath.

With that begins the watch of Jon Snow. He is assigned the task to support the stewards.

This time he has n stewards with him whom he has to provide support. Each steward has his own strength. Jon Snow likes to support a steward only if there exists at least one steward who has strength strictly less than him and at least one steward who has strength strictly greater than him.

Can you find how many stewards will Jon support?

夜幕降临,我的守望自此开始。它将永不停止,直至我生命终结。我将不娶妻,不封地,不生子;不戴王冠,不争荣光;我将坚守岗位,生于此,死于此。我是暗夜中的利剑,城墙上的守望者,守护人类疆域的盾牌。我以我的生命与荣誉起誓,加入守夜人军团,今夜如此,夜夜皆然。” —— 守夜人誓言。

由此,琼恩·雪诺的守望开始了。他此次受命支援若干位事务官。

这一次,他身边共有 nn 位事务官需他提供支援。每位事务官都有其自身的力量值。琼恩·雪诺仅愿支援那些至少存在一位力量严格小于他、且至少存在一位力量严格大于他的事务官。

请问:琼恩将支援多少位事务官?

输入格式

First line consists of a single integer n (1 ≤ n ≤ 105) — the number of stewards with Jon Snow.

Second line consists of n space separated integers _a_1, _a_2, ..., a__n (0 ≤ a__i ≤ 109) representing the values assigned to the stewards.

第一行包含一个整数 nn(1≤n≤1051 \leq n \leq 10^5)—— 表示琼恩·雪诺所拥有的守夜人数量。

第二行包含 nn 个以空格分隔的整数 a1, a2, …, ana_1,\,a_2,\,\dots,\,a_n(0≤ai≤1090 \leq a_i \leq 10^9),表示分配给各位守夜人的数值。

输出格式

Output a single integer representing the number of stewards which Jon will feed.

输出一个整数,表示琼将要喂养的守夜人数量。

输入输出样例

  • 输入#1

    2
    1 5

    输出#1

    0
  • 输入#2

    3
    1 2 5

    输出#2

    1

说明/提示

In the first sample, Jon Snow cannot support steward with strength 1 because there is no steward with strength less than 1 and he cannot support steward with strength 5 because there is no steward with strength greater than 5.

In the second sample, Jon Snow can support steward with strength 2 because there are stewards with strength less than 2 and greater than 2.

在第一个样例中,琼恩·雪诺无法支持力量值为 1 的守夜人,因为不存在力量值小于 1 的守夜人;他也不能支持力量值为 5 的守夜人,因为不存在力量值大于 5 的守夜人。

在第二个样例中,琼恩·雪诺可以支持力量值为 2 的守夜人,因为存在力量值小于 2 和大于 2 的守夜人。

输入解题思路,AI测评打分。不知道怎么写?

首页