Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 6

#include <iostream>

#include <fstream>
#include <cstdlib>
using namespace std;

int n, a[100][100], nv, nr, r[100], nl, l[100][10], c[100];


struct nume
{
char name[20];
};
nume judet[100], regiune[100], vecini[100];

ifstream judete("C:\\Users\\Chinezu\\Desktop\\judete.txt");

void read()
{
judete>>n;
for(int i=1;i<=n;i++)
for(int j=1;j<=n;j++)
judete>>a[i][j];

judete.get();

for(int i=1;i<=n;i++)
{
judete.getline(judet[i].name,20);

judete>>nv;
judete.get();
for(int i=1;i<=nv;i++)
{
judete.getline(vecini[i].name,20);
}

judete>>nr;
judete.get();
for(int i=1;i<=nr;i++)
{
judete.getline(regiune[i].name,20);
}

for(int i=1;i<=n;i++)
judete>>r[i];

//judete>>nl;
//for(int i=1;i<=nl;i++)
// for(int j=1;l[i][j]!=0;j++)
// judete>>l[i][j];

void A()
{
int max, k;
for(int i=1;i<=n;i++)
{
max=0;k=0;
for(int j=1;j<=n;j++)
{
if(a[i][j]==1)
k++;
}
if(max<k)
max=k;
}
cout<<"maximul este "<<max<<"\n";
for(int i=1;i<=n;i++)
{
k=0;
for(int j=1;j<=n;j++)
{
if(a[i][j]==1)
k++;
}
if(max==k)
cout<<judet[i].name<<"\n ";
}
cout<<"\n\n";
}

void B()
{
int min=0, k;
for(int j=1;j<=n;j++)
if(a[1][j]==1)
min++;
for(int i=1;i<=n;i++)
{
k=0;
for(int j=1;j<=n;j++)
{
if(a[i][j]==1)
k++;
}
if(min>k)
min=k;
}
cout<<"minimul este "<<min<<"\n";
for(int i=1;i<=n;i++)
{
k=0;
for(int j=1;j<=n;j++)
{
if(a[i][j]==1)
k++;
}
if(min==k)
cout<<judet[i].name<<" \n";
}
cout<<"\n\n";
}

void D()
{
for(int j=1;j<=nr;j++)
{
cout<<regiune[j].name<<": ";
for(int i=1;i<=n;i++)
if(r[i]==j)
cout<<judet[i].name<<" ";

cout<<"\n\n";
}
for(int i=1;i<=nr;i++)
for(int j=1;j<=n;j++)
if(r[j]==i)
c[i]++;
int max=0;
for(int i=1;i<=nr;i++)
if(max<c[i])
max=c[i];
for(int i=1;i<=nr;i++)
if(max==c[i])
cout<<regiune[i].name<<" are cel mai mare numar de judete,
"<<max<<"\n";
int min=c[1];
for(int i=1;i<=nr;i++)
if(min>c[i])
min=c[i];
for(int i=1;i<=nr;i++)
if(min==c[i])
cout<<regiune[i].name<<" are cel mai mic numar de judete,
"<<min<<"\n";

int main()
{

read();
A();
B();
D();
return 0;
}

42
0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1
0 0 0 0 0 1 0 0 0 0 0 1 0 0
1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 1 0 0 0 0 1
0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 0 1 0 1 0 0 0 1 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 0
1 0 0 0 0 0 0 0 0 0 1 0 1 0
1 1 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 1 1 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 0 1
0 0 0 0 0 0 1 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0
1 0 0 0 0 0 1 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 0 0 0 0 1
0 0 1 0 0 1 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0
0 0 0 0 0 0 0 0 0 1 0 0 1 0
0 0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 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 0 0 0 1 0 0
0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0
0 1 0 0 0 0 0 0 0 0 0 0 0 1
0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 1
0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0
1 0 0 0 0 0 0 0 0 0 0 0 0 1
1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 1 0 0 0 0 0 0
0 1 0 0 0 1 0 0 0 0 0 0 0 0
0 0 0 1 0 0 0 0 1 1 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 1 0 0 1 0 1 0 0 0 1 1 0 1 0 0 1 1 1 0 0 0 0 1 0 1 1 0
0 1 0 1 0 0 1 1 1 1 1 0 0 0
Alba
Arad
Arges
Bacau
Bihor
Bistrita_Nasaud
Botosani
Brasov
Braila
Buzau
Calarasi
Caras_Severin
Cluj
Constanta
Covasna
Dambovita
Dolj
Galati
Giurgiu
Gorj
Harghita
Hunedoara
Ialomita
Iasi
Ilfov
Maramures
Mehedinti
Mures
Neamt
Olt
Prahova
Salaj
Satu_Mare
Sibiu
Suceava
Teleorman
Timis
Tulcea
Valcea
Vaslui
Vrancea
Bucuresti
5
Bulgaria
Serbia
Ungaria
Ucraina
Moldova
9
Dobrogea
Muntenia
Oltenia
Banat
Crisana
Maramures
Bucovina
Moldova
Transilvania
1 1 1 3 1 1 1 3 1 1 1 5 1 1 6 1 1 1 1 5 1 1 1 1 1 2 1 1 1 1 1 6 1 1 1 1 9 1 1 5 1 1
16
2 3 0
7 4 5 0
11 1 0
12 2 0
14 1 0
17 1 0
18 5 0
19 1 0
24 5 0
26 4 0
30 1 0
32 3 4 0
36 1 0
37 2 3 0
38 4 0
39 5 0

You might also like