#include <iostream>
#include<vector>
using namespace std;
int square(int x){
for (int i = 1; i <= 45; ++i){
if (i * i <= x){
continue;
}
return (i - 1) * (i - 1);
int main()
{
int x, y, xwas, ywas, xywas;
cin >> x >> y;
xwas = square(x);
ywas = square(y);
xywas = square(x + y);
if (xwas + ywas < xywas){
cout << "Petya gives paint to Vasya";
else if (xwas + ywas == xywas){
cout << "Equal";
else {
cout << "Petya leaves paint to himself";
return 0;
}#include <iostream>
Объяснение:
number = int(input())
last_number = 0
even = 0
odd = 0
while (number > 0):
last_number = number % 10
if (last_number % 2 == 0):
even += 1
else:
odd += 1
number //= 10
print("Even = ", even, "Odd = ", odd)
number = int(input()) // Объявление + ввод переменной
last_number = 0 // Переменная для хранения последней цифры числа
even = 0 // Количество четных
odd = 0 // Количество нечетных
while (number > 0): // Пока число > 0
last_number = number % 10 // Получаем последнюю цифру числа
if (last_number % 2 == 0): // Если цифра делится на 2 без остатка
even += 1 // В переменную even делаем + 1
else: // Иначе
odd += 1 // В переменную odd делаем + 1
number //= 10 // Удаляем последнюю цифру числа
print("Even = ", even, "Odd = ", odd) // Вывод
#include <iostream>
#include<vector>
using namespace std;
int square(int x){
for (int i = 1; i <= 45; ++i){
if (i * i <= x){
continue;
}
return (i - 1) * (i - 1);
}
}
int main()
{
int x, y, xwas, ywas, xywas;
cin >> x >> y;
xwas = square(x);
ywas = square(y);
xywas = square(x + y);
if (xwas + ywas < xywas){
cout << "Petya gives paint to Vasya";
}
else if (xwas + ywas == xywas){
cout << "Equal";
}
else {
cout << "Petya leaves paint to himself";
}
return 0;
}#include <iostream>
#include<vector>
using namespace std;
int square(int x){
for (int i = 1; i <= 45; ++i){
if (i * i <= x){
continue;
}
return (i - 1) * (i - 1);
}
}
int main()
{
int x, y, xwas, ywas, xywas;
cin >> x >> y;
xwas = square(x);
ywas = square(y);
xywas = square(x + y);
if (xwas + ywas < xywas){
cout << "Petya gives paint to Vasya";
}
else if (xwas + ywas == xywas){
cout << "Equal";
}
else {
cout << "Petya leaves paint to himself";
}
return 0;
}
Объяснение:
number = int(input())
last_number = 0
even = 0
odd = 0
while (number > 0):
last_number = number % 10
if (last_number % 2 == 0):
even += 1
else:
odd += 1
number //= 10
print("Even = ", even, "Odd = ", odd)
Объяснение:
number = int(input()) // Объявление + ввод переменной
last_number = 0 // Переменная для хранения последней цифры числа
even = 0 // Количество четных
odd = 0 // Количество нечетных
while (number > 0): // Пока число > 0
last_number = number % 10 // Получаем последнюю цифру числа
if (last_number % 2 == 0): // Если цифра делится на 2 без остатка
even += 1 // В переменную even делаем + 1
else: // Иначе
odd += 1 // В переменную odd делаем + 1
number //= 10 // Удаляем последнюю цифру числа
print("Even = ", even, "Odd = ", odd) // Вывод