<script> function DeShifr() { let Text = document.getElementById("shifr").value; let L = Text.length; let NeChet = Text.substr(0,L/2+L%2); let Chet = Text.substr(L/2+L%2,L/2); let DeShifr = ""; for (let i = 0, c = 0, n = 0; i < L; i++) { DeShifr += (i%2?Chet[c++]:NeChet[n++]); } document.getElementById("DeShifr").innerHTML = DeShifr; } </script> </head> <body> <form> <label for="shifr">Введите зашифрованный тест сообщения:</label> <textarea id="shifr"></textarea> <button type="button" onCLick="DeShifr()">Расшифровать</button> <div id="DeShifr"></div> </form> </body> </html>
using namespace std;
int main()
{
size_t N = 0, val = 0, count = 0;
cin >> N;
if (N < 100) {
for(size_t i = 0; i < N; ++i) {
cin >> val;
if (val < 300) {
if (!(val % 3)) ++count;
} else {
cout << "Value must be < 300" << endl;
exit(1);
}
}
} else {
cout << "N must be < 100" << endl;
}
cout << "Count: " << count << endl;
return 0;
}
<html>
<head>
<style>
body {
text-align: center;
}
form {
display: inline-block;
width: 40%;
}
label {
display: block;
}
textarea {
width: 100%;
height: 300px;
}
button {
width: 45%;
}
</style>
<script>
function DeShifr()
{
let Text = document.getElementById("shifr").value;
let L = Text.length;
let NeChet = Text.substr(0,L/2+L%2);
let Chet = Text.substr(L/2+L%2,L/2);
let DeShifr = "";
for (let i = 0, c = 0, n = 0; i < L; i++)
{
DeShifr += (i%2?Chet[c++]:NeChet[n++]);
}
document.getElementById("DeShifr").innerHTML = DeShifr;
}
</script>
</head>
<body>
<form>
<label for="shifr">Введите зашифрованный тест сообщения:</label>
<textarea id="shifr"></textarea>
<button type="button" onCLick="DeShifr()">Расшифровать</button>
<div id="DeShifr"></div>
</form>
</body>
</html>