-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSondaje de opinie.cpp
45 lines (40 loc) · 1.06 KB
/
Sondaje de opinie.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<iostream>
#include<vector>
#include<string>
using namespace std;
int main(){
int aux,partide,stat,nr,max=0,ok=0;string nume_max;
string nume_partid;
cin>>partide>>stat;
vector<string>asc;
vector<int>numere;
for(int i=0;i<partide;i++){
cin>>nume_partid;
for(int j=0;j<stat;j++){
cin>>nr;
numere.push_back(nr);
}
for(int x=0;x<numere.size()-1;x++){
if(numere[x]>numere[x+1]){
ok++;
}
}
if(ok==0){
asc.push_back(nume_partid);
}
ok=0;
aux=numere[stat-1]-numere[0];
//cout<<nume_partid<<' '<<aux<<' '<<max<<' '<<nume_max<<endl;
if(max<aux){
max=aux;
nume_max=nume_partid;
}
aux=0;
numere.clear();
}if(asc.size()>0){
for(int i=0;i<asc.size();i++){
cout<<asc[i]<<' ';
}}else{cout<<"Nu exista";}
cout<<endl;
cout<<nume_max<<' '<<max<<"%";
}