1.
#include <iostream>
#include <vector>
using namespace std;
int main(){
int a,b;
cin>>a;
vector<int> v1;
vector<int> v2;
for(int i=0; i<a; i++){
cin>>b;
if (b%2==0) v1.emplace_back(b);
else v2.emplace_back(b);
}
sort(v1.begin(), v1.end());
sort(v2.begin(), v2.end());
for(auto & i: v1) cout<<i<<" ";
}
2.
#include <iostream>
#include <vector>
using namespace std;
int main(){
vector<float> v;
//здесь нам задают массив
sort(v.begin(), v.end());
cout<<v[0]<<v.back();
}
Вопрос скорее будет звучать "как много могли съесть толстяки?".
#include <iostream>
using namespace std;
int main() {
int multiplier = 1;
float weightCake = 0;
float t1(0), t2(0), t3(0);
float t1Cakes(0), t2Cakes(0), t3Cakes(0);
cout << "Weight of cake, fat people 1-3: ";
cin >> weightCake; cin >> t1; cin >> t2; cin >> t3;
while(1) {
t1Cakes = multiplier * weightCake * 1;
if(t1Cakes > t1/2) {
cout << multiplier - 1;
break;
}
t2Cakes = multiplier * weightCake * 2;
if(t2Cakes > t2/2) {
cout << multiplier - 1;
break;
}
t3Cakes = multiplier * weightCake * 4;
if(t3Cakes > t3/2) {
cout << multiplier - 1;
break;
}
++multiplier;
}
}