var
n, Num, i, j, t: integer;
Count: array[1..12] of integer;
Names: array[1..12] of integer;
begin
for i := 1 to 12 do
begin
Count[i] := 0;
Names[i] := i;
end;
ReadLn(N); { Считываем количество запросов}
for i := 1 to N do
begin
ReadLn(t); {считали очередной запрос}
Count[t] := Count[t] + 1;
end;
{Сортируем массивы Names и Count в порядке убывания значений массива Count}
for i := 12 downto 2 do
for j := 2 to i do
if Count[j - 1] < Count[j] then
begin
t := Count[j];
Count[j] := Count[j - 1];
Count[j - 1] := t;
t := Names[j];
Names[j] := Names[j - 1];
Names[j - 1] := t;
end;
for i := 12 downto 1 do
if Count[i] > 0 then
WriteLn(Names[i], ' ', Count[i]);
end.
Объяснение:
#include <iostream>
#include <ctime>
#include <iomanip>
#include <vector>
using namespace std;
typedef vector< vector<int> > T;
ostream &operator<<(ostream &output,const T &mass)
{
for(size_t i = 0;i<mass.size();++i){
for(size_t j = 0;j<mass.size();++j)
output<<setw(5)<<mass[j];
output<<"\n\n";
}
return output;
}
int _tmain(int argc, _TCHAR* argv[])
{
srand((unsigned)time(0));
unsigned int row,col;
do{
cout<<"Enter rows > 0"<<endl;
cin>>row;
}while(row <= 0);
do{
cout<<"Enter col > 0"<<endl;
cin>>col;
}while(col <= 0);
T mass(row, vector<int>(col));
for(size_t i = 0;i < row;++i){
for(size_t j = 0;j < col;++j)
mass[j] = rand()%10;
}
cout<<mass;
return 0;
}
a = int(input())
b = int(input())
x=a**3+4*b-abc(4*a**2-7)
print(x)