Имеется пять шаров: белый, желтый, зеленый, красный, синий. в каждый из пяти пронумерованных ящиков положили по одному шару и закрыли его. пятерых попросили отгадать цвета шаров, находящихся в любых трех ящиках. они сделали следующие предположения:
артем: желтый шар в 5-м ящике, белый шар в 4-м ящике, синий шар во 2-м ящике;
борис: желтый шар в 1-м ящике, белый шар во 2-м ящике, синий шар в 3-м ящике;
вадим: красный шар в 1-м ящике, белый шар в 4-м ящике, синий шар во 2-м ящике;
глеб: белый шар в 3-м ящике, зеленый шар в 5-м ящике, красный шар во 2-м ящике;
дмитрий: красный шар в 5-м ящике, синий шар в 1-м ящике, желтый шар в 3-м ящике.
после открывания ящиков выяснилось, что каждый из сделал ровно одно верное предположение. определите цвет шара, находящегося в каждом ящике. в ответе перечислите подряд без пробелов первые буквы цветов шаров в порядке занятых ими ящиков.
#include <iostream>
#include <cmath>
int main()
{
float x1, y1, x2, y2;
std::cout << "x1 :" << std::endl;
std::cin >> x1;
std::cout << "y1 :" << std::endl;
std::cin >> y1 ;
std::cout << "x2 :" << std::endl;
std::cin >> x2;
std::cout << "y2 :" << std::endl;
std::cin >> y2;
float result = std::sqrt((std::pow(std::abs(x1-x2), 2) + std::pow(std::abs(y1-y2), 2)));
std::cout << result << std::endl;
char * temp = new char[0]();
std::cin >> temp;
return 0;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Время суток</title>
<style>
h5 {
width: fit-content;
}
h5:hover::after {
content: "<KEK";
}
</style>
<link rel="stylesheet" href="style.css" />
<script src="script.js"></script>
</head>
<body>
<header>
<h1>Приложение "Времена года"</h1>
</header>
<hr />
<main>
<label for="vre">Какой месяц года проверить?</label>
<input type="text" id="vre" />
<button id="b1">Обработать информацию</button>
<div id="image_box">
<img id="image" src="hello.png" />
</div>
</main>
<hr />
<footer>
<h5>Copyright: © Teacher - Kyiv, 2019</h5>
</footer>
<script>
"use strict";
(function() {
const b1 = document.getElementById("b1");
b1.onclick = function() {
const vre = document.getElementById("vre");
const image = document.getElementById("image");
if (vre.value.match(/(декаб|янва)рь|февраль/gi)) {
alert("Зима");
image.src = "winter.png";
} else if (vre.value.match(/март|апрель|май/gi)) {
alert("Весна");
image.src = "spring.png";
} else if (vre.value.match(/ию(л|н)ь|август/gi)) {
alert("Лето");
image.src = "summer.png";
} else if (vre.value.match(/(сент|окт|но)ябрь/gi)) {
alert("Осень");
image.src = "autumn.png";
} else {
alert("Вы ввели неверный месяц");
}
};
})();
</script>
</body>
</html>