1) #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> arr;
int N;
int sum = 0;
cin >> N;
for(int i = 0; i<N; ++i) {
int temp;
cin >> temp;
arr.push_back(temp);
if(i==0) {
sum = arr[i];
} else {
sum*=arr[i];
}
cout << "Sum: " << sum;
2) #include <iostream>
int sum2(0), sum3(0);
if(arr[i]>9&&arr[i]<100) {
if(sum2==0) {
sum2=arr[i];
sum2*=arr[i];
if(arr[i]>99&&arr[i]<1000) {
sum3+=arr[i];
cout << "Sum2: " << sum2 << endl << "Sum3: " << sum3;
#include <iostream>
class Building {
private:
string adress_m;
int storeyCount_m;
bool quarantine_m;
public:
Building(string adress = "", int count = -1) {
adress_m = adress;
storeyCount_m = count;
void addStoreys(int count) {
storeyCount_m += count;
void quarantineOn() {
cout << "Quarantine: on";
cout << endl;
quarantine_m = 1;
void quarantineOff() {
cout << "Quarantine: off";
quarantine_m = 0;
void quarantineCheck() {
cout << "Quarantine: ";
if(quarantine_m) {
cout << "on";
cout << "off";
string getAdress() {
return adress_m;
int getStorey() {
return storeyCount_m;
};
Building build("dirt house", 1);
cout << build.getAdress() << " " << build.getStorey() << " storeys" << " " << endl;
build.quarantineCheck();
build.quarantineOn();
build.addStoreys(2);
1) #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> arr;
int N;
int sum = 0;
cin >> N;
for(int i = 0; i<N; ++i) {
int temp;
cin >> temp;
arr.push_back(temp);
if(i==0) {
sum = arr[i];
} else {
sum*=arr[i];
}
cout << "Sum: " << sum;
}
2) #include <iostream>
#include <vector>
using namespace std;
int main() {
vector<int> arr;
int N;
cin >> N;
int sum2(0), sum3(0);
for(int i = 0; i<N; ++i) {
int temp;
cin >> temp;
arr.push_back(temp);
if(arr[i]>9&&arr[i]<100) {
if(sum2==0) {
sum2=arr[i];
} else {
sum2*=arr[i];
}
} else {
if(arr[i]>99&&arr[i]<1000) {
sum3+=arr[i];
}
}
}
cout << "Sum2: " << sum2 << endl << "Sum3: " << sum3;
}
#include <iostream>
using namespace std;
class Building {
private:
string adress_m;
int storeyCount_m;
bool quarantine_m;
public:
Building(string adress = "", int count = -1) {
adress_m = adress;
storeyCount_m = count;
}
void addStoreys(int count) {
storeyCount_m += count;
}
void quarantineOn() {
cout << "Quarantine: on";
cout << endl;
quarantine_m = 1;
}
void quarantineOff() {
cout << "Quarantine: off";
cout << endl;
quarantine_m = 0;
}
void quarantineCheck() {
cout << "Quarantine: ";
if(quarantine_m) {
cout << "on";
cout << endl;
} else {
cout << "off";
cout << endl;
}
}
string getAdress() {
return adress_m;
}
int getStorey() {
return storeyCount_m;
}
};
int main() {
Building build("dirt house", 1);
cout << build.getAdress() << " " << build.getStorey() << " storeys" << " " << endl;
build.quarantineCheck();
build.quarantineOn();
build.addStoreys(2);
cout << build.getAdress() << " " << build.getStorey() << " storeys" << " " << endl;
}