/* C++ compiler gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010 Copyright (C) 2015 Free Software Foundation, Inc. */
#include <iostream> #include <vector> using namespace std;
int main() { int count = 0; cout <<"Введите количество призывников: "; cin >>count; if (count>17) count=17; vector<int> tanks(count); for (unsigned i=0; i<tanks.size(); i++) cin >>tanks[i]; int min=300, max=0; for (unsigned i=0; i<tanks.size(); i++) { if (min>tanks[i]) min=tanks[i]; if (max<tanks[i]) max=tanks[i]; } int cnt=0; for (unsigned i=0; i<tanks.size(); i++) { if ((tanks[i]!=min) and (tanks[i]!=max)) cnt++; }
Var a:array[1..100,1..100] of integer; i,j,n,m,max,min:integer; begin write ('Введите количество строк: '); read(n); writeln; write ('Введите количество элементов в строке: '); read(m); writeln; writeln('Введите массив: '); for i:=1 to n do begin for j:=1 to m do begin write(' a[',i,',',j,']='); read(a[i,j]); end; writeln; end; writeln; writeln('Исходный массив: '); for i:=1 to n do begin for j:=1 to m do write(a[i,j],' '); writeln; end; writeln; writeln('Конечный массив: '); for i:=1 to n do begin min:=a[i,1]; max:=a[i,1]; for j:=2 to m do begin if (min>a[i,j]) then min:=a[i,j]; if (max
C++ compiler
gcc (Ubuntu 5.2.1-22ubuntu2) 5.2.1 20151010
Copyright (C) 2015 Free Software Foundation, Inc.
*/
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int count = 0;
cout <<"Введите количество призывников: ";
cin >>count;
if (count>17) count=17;
vector<int> tanks(count);
for (unsigned i=0; i<tanks.size(); i++) cin >>tanks[i];
int min=300, max=0;
for (unsigned i=0; i<tanks.size(); i++)
{
if (min>tanks[i]) min=tanks[i];
if (max<tanks[i]) max=tanks[i];
}
int cnt=0;
for (unsigned i=0; i<tanks.size(); i++)
{
if ((tanks[i]!=min) and (tanks[i]!=max)) cnt++;
}
cout <<cnt <<endl;
}