#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;
}
{данная программа переводит любое сочетание символов ascii в систему счисления заданную пользователем.}
//pascal abc.net v3.0 сборка 1111
var
a,i,b,r,n,j,bug: integer;
s,se,slo,slof: string;
procedure preob(var a,b,n: integer; var se: string);
begin
repeat
b: =a mod n;
a: =a div n;
str(b,se);
s+=se;
until (a< =n-1);
end;
beginreadln(slo);
readln(n);
for j: =1 to length(slo) do
begin;
a: =ord(slo[j]);
preob(a,b,n,se);
str(a,se);
s+=se;
for i: =1 to length(s) div 2 do
begin;
se: =s[i];
s[i]: =s[length(s)-i+1];
s[length(s)-i+1]: =se[1];
end;
write(s,'-');
slof: =slof+s;
delete(s,1,length(s));
end;
end.
пример ввода:
работа на завтра.
2
пример вывода:
11000100-11101110-11101100-11100000-11111000-11101101-11111111-11111111-100000-11110000-11100000-11100001-11101110-11110010-11100000-100000-11101101-11100000-100000-11100111-11100000-11100010-11110010-11110000-11100000-101110-
{таким образом, фразу " работа на завтра." можно закодировать как "11000100-11101110-11101100-11100000-11111000-11101101-11111111-11111111-100000-11110000-11100000-11100001-11101110-11110010-11100000-100000-11101101-11100000-100000-11100111-11100000-11100010-11110010-11110000-11100000-101110-".}