#include <iostream>
int main() {
int count = 0;
long num;
std::cout << "Введите ваше число: ";
std::cin >> num;
int previous1 = -1;
int previous2 = -1;
int current;
while (num > 0) {
current = num % 10;
num /= 10;
if (previous2 == 7 && previous1 == 7 && current == 7) {
count += 1;
break;
}
previous2 = previous1;
previous1 = current;
}
if (count > 0) {
std::cout << 'T' << std::endl;
} else {
std::cout << 'F' << std::endl;
}
return 0;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Sortable - Default functionality</title>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.14.0/themes/base/jquery-ui.css">
<style>
#sortable {
list-style-type: none;
margin: 0;
padding: 0;
width: 60%;
}
#sortable li {
margin: 0 3px 3px 3px;
padding: 0.4em;
padding-left: 1.5em;
font-size: 1.4em;
height: 18px;
}
#sortable li span {
position: absolute;
margin-left: -1.3em;
}
</style>
<script src="https://code.jquery.com/jquery-3.7.1.js"></script>
<script src="https://code.jquery.com/ui/1.14.0/jquery-ui.js"></script>
<script src="jquery.ui.touch-punch.min.js"></script>
<script>
$(function () {
const $sortable = $("#sortable");
$sortable.sortable({
disabled: true
});
$sortable.on("contextmenu", function (e) {
e.preventDefault();
});
$sortable.on("touchstart", function () {
$(this).sortable("option", "disabled", false);
});
});
</script>
</head>
<body>
<ul id="sortable">
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 1</li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 2</li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 3</li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 4</li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 5</li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 6</li>
<li class="ui-state-default"><span class="ui-icon ui-icon-arrowthick-2-n-s"></span>Item 7</li>
</ul>
</body>
</html>
import math
while True:
a = int(input("ax^2+bx+c=0 / a: "))
b = int(input("ax^2+bx+c=0 / b: "))
c = int(input("ax^2+bx+c=0 / c: "))
d = b ** 2 - 4 * a * c
if d > 0:
x1 = (-b + math.sqrt(d)) / (2 * a)
x2 = (-b - math.sqrt(d)) / (2 * a)
print(f'Корней: 2. \n x1 = {x1}')
print(f'Корней: 2. \n x2 = {x2}')
elif d == 0:
x1 = -b / (2 * a)
print(f'Корень: 1. \n x1 = {x1}')
else:
print("Корней: 0")
<html>
<body onload="bodyload()">
<button onclick="colorchangerclick()">newcolor</button>
<script>
function bodyload() {
document.body.addEventListener("bodybgcolorchange", () => alert("bodybgcolorchange сработало!"));
}
function colorchangerclick() {
document.body.style.background = prompt("Введите новый цвет фона (например, red, #000, rgb(0, 0, 0))");
const bodybgcolorchange = new CustomEvent("bodybgcolorchange", {
detail: {
name: "bodybgcolor",
},
});
document.body.dispatchEvent(bodybgcolorchange);
}
</script>
</body>
</html>
@upload_router.post('')
async def upload_file(
request: Request,
file: Annotated[UploadFile, File()],
):
file_content = await file.read()
await s3_client.upload_fileobj(
io.BytesIO(file_content),
'bucket-name',
f'{unique_filename}_{file.filename}'
)
from datetime import datetime, timedelta
def find_youngest_birthday(employees, current_date):
current_date = datetime.strptime(current_date, '%d.%m.%Y')
start_date = current_date + timedelta(days=1)
end_date = current_date + timedelta(days=7)
youngest_employee = None
youngest_birthday = None
youngest_age = None
for employee in employees:
birthday = datetime.strptime(employee['birthday'], '%d.%m.%Y')
birthday_this_year = birthday.replace(year=current_date.year)
if start_date <= birthday_this_year <= end_date:
age = current_date.year - birthday.year
if current_date.month < birthday.month or (current_date.month == birthday.month and current_date.day < birthday.day):
age -= 1
if youngest_employee is None or age < youngest_age:
youngest_employee = employee
youngest_age = age
youngest_birthday = birthday_this_year
elif age == youngest_age and birthday_this_year > youngest_birthday:
youngest_employee = employee
youngest_birthday = birthday_this_year
if youngest_employee:
return f"{youngest_employee['name']} {youngest_employee['surname']}"
else:
return "Дни рождения не планируются"
current_date = input()
n = int(input())
employees = []
for _ in range(n):
name, surname, birthday = input().split()
employees.append({'name': name, 'surname': surname, 'birthday': birthday})
print(find_youngest_birthday(employees, current_date))
<?php foreach ($fields as $field): ?>
<?= Html::activeHiddenInput($model, "[$field->id]id_field", ['value' => $field->id]) ?>
<?= $form->field($model, "[$field->id]data")->textInput(['value' => $model->data]) ?>
<?php endforeach; ?>
Field_Data[1][id_field] = 1
Field_Data[1][data] = "значение поля 1"
Field_Data[2][id_field] = 2
Field_Data[2][data] = "значение поля 2"
if (Yii::$app->request->post('Field_Data')) {
foreach (Yii::$app->request->post('Field_Data') as $fieldData) {
$model = new FieldData();
$model->id_field = $fieldData['id_field'];
$model->data = $fieldData['data'];
if ($model->validate()) {
$model->save();
}
}
}
server {
listen 443 ssl;
server_name your-domain.com;
ssl_certificate /etc/nginx/ssl/your_domain.crt;
ssl_certificate_key /etc/nginx/ssl/your_domain.key;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
# Прокси для WebSocket
location /wss/ {
proxy_pass http://localhost:8080;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
location / {
proxy_pass http://localhost:80;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
class ProductAmount
{
function __construct($array = array()) {
...
}
function getOfers($items = []) {
...
return $this;
}
function getProfuctStore($inListStore = 'N') {
...
return $this;
}
function setListStore($inListStore = 'Y') {
...
return $this;
}
}
$obj = new ProductAmount();
$res = $obj->getOfers([229411])->getProfuctStore('Y')->setListStore('Y');
useEffect(() => {
sessionStorage.setItem('isReloading', 'true');
const handleBeforeUnload = (event) => {
const isReloading = sessionStorage.getItem('isReloading');
if (isReloading === 'false') {
QDB.edit(manager.id, { online: 0, logout_date: D_TimeNow(), navigator: navigator.userAgent }, 'users');
}
};
const handleUnload = () => {
sessionStorage.setItem('isReloading', 'false');
};
window.addEventListener('beforeunload', handleBeforeUnload);
window.addEventListener('unload', handleUnload);
return () => {
window.removeEventListener('beforeunload', handleBeforeUnload);
window.removeEventListener('unload', handleUnload);
};
}, []);
from dotenv import load_dotenv
import os
load_dotenv()
TOKEN = os.getenv("TINKOFF_INVEST_TOKEN")
TINKOFF_INVEST_TOKEN=мой токен
$responsibleId = 123;
$responsibleName = "Иван Иванов";
$updateComm = CRest::call(
'crm.timeline.comment.add',
array(
'fields' => array(
'ENTITY_ID' => $dealId,
'ENTITY_TYPE' => 'deal',
'COMMENT' => "Ответственный: $responsibleName (#$responsibleId)"
)
)
);
void MyTextEdit::contextMenuEvent(QContextMenuEvent *event) {
QPoint mousePos = event->pos();
QTextCursor cursor = cursorForPosition(mousePos);
int blockNumber = cursor.blockNumber();
QMenu *menu = createStandardContextMenu();
menu->addAction(QString("Строка: %1").arg(blockNumber + 1));
menu->exec(event->globalPos());
delete menu;
}