#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
int main() {
vector<float> coordinates;
string a;
getline(cin, a);
string buffer;
for(int i = 0; i<a.length(); ++i) {
if(a[i]!=' ') {
buffer+=a[i];
} if(a[i]==' '||i==a.length()-1) {
if(buffer[buffer.length()-1]=='.') {
buffer+="0";
}
float num = stof(buffer);
coordinates.push_back(num);
buffer = "";
}
}
if(coordinates.size()!=4) {
cout << "wrong data. example: 1.1 2.2 3.3 4.4";
}
float result;
int temp1, temp2, temp3, temp4;
temp1 = coordinates[0]-coordinates[2];
temp2 = coordinates[1]-coordinates[3];
temp1 = temp1 * temp1;
temp2 = temp2 * temp2;
temp3 = temp1 + temp2;
result = sqrt(temp3);
cout << result;
}
number = 1
number_list = []
while number != '0':
number = str(input())
number_list.append(number)
if number == '0':
number_list.remove(number)
break
second_list = []
for n in number_list:
if int(n) % 3 == 0 and n[-1] == '9':
second_list.append(n)
amount = 0
for num in second_list:
amount += int(num)
print(amount)
Объяснение: