#include <iostream>
#include <cmath>
using namespace std;
double Otr(double Ax, double Bx, double Ay, double By) {
return sqrt((Bx - Ax)*(Bx - Ax) + (By - Ay)*(By - Ay));
}
int main() {
double Ax, Ay, Bx, By, Cx, Cy, Dx, Dy;
cin >> Ax >> Ay >> Bx >> By >> Cx >> Cy >> Dx >> Dy;
cout << "|AB|=" << Otr(Ax, Bx, Ay, By) << endl;
cout << "|AC|=" << Otr(Ax, Cx, Ay, Cy) << endl;
cout << "|AD|=" << Otr(Ax, Dx, Ay, Dy) << endl;
return 0;
}
import java.util.Scanner;
public class Main {
static int col=0;
public static void main(String[] args) {
Container c1 =new Container(10,4,2.5);
v2(c1);
System.out.println(col);
}
static void v2(Container container) {
System.out.println("Ведите размеры авто");
Scanner scanner = new Scanner(System.in);
double l= scanner.nextInt();
double h=scanner.nextInt();;
double w=scanner.nextInt();;
Car car = new Car(l,h,w);
if (container.hashCode() >= car.hashCode()) {
container.widht = container.widht - car.widht;
container.height= container.height - car.height;
container.leng = container.leng - car.leng;
col++;
v2(container);
}
}
}
public class Car {
final double leng;
final double height;
final double widht;
Car(double leng,double height,double widht){
this.leng=leng;
this.height=height;
this.widht=widht;
}
@Override
public int hashCode() {
return (int) (leng+height+widht);
}
}
public class Container {
static double leng;
static double height;
static double widht;
Container(double leng,double height,double widht){
this.leng=leng;
this.height=height;
this.widht=widht;
}
@Override
public int hashCode() {
return (int) (leng+height+widht);
}
}
прога с комментариями на фото
Объяснение:
вводим последовательность цифр через ентер, концом последовательности значит цифра 0, считаем среднее арифметическое четных цифр, если не было введено ни одного четного, выводим, нет четных