#include <iostream>
#include <vector>
using namespace std;
int main(){
int n;
cin >> n;
vector<int> res;
for(int i = 0; i < n; i++){
int x;
cin >> x;
int x1 = x, x2 = x, cnt = 0;
while(x1 > 0){
cnt++;
x1 /= 10;
}
if(cnt % 2 == 1){
int xx = 0, u = 0;
while(x2 > 0){
xx += (x2 % 10) * pow(10,u);
u++;
x2 /= 10;
}
if(x == xx)
res.push_back(i + 1);
}
}
for(auto &i : res)
cout << i << " ";
}
Код на C++:
#include <iostream>
#include <ctime>
using namespace std;
int main()
{
setlocale(LC_ALL, "rus");
srand(time(NULL));
int rows = 30;
int chairs = 0;
for (int i = 1, count_of_chairs = 20; i <= 30; i++, count_of_chairs += 2)
{
chairs += count_of_chairs;
}
cout << chairs << endl;
return 0;
};
Код на Python:
rows = 30
chairs = 0
count_of_chairs = 20
for i in range(1, 31, 1):
chairs += count_of_chairs
count_of_chairs += 2
print(chairs)
Объяснение: