#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;
}
Объяснение:
Sub abc()
Dim i As Integer, aMax As Integer, aMin As Integer, n As Integer
n = 15
ReDim a(1 To n) As Integer
For i = 1 To n
a(i) = InputBox("Введи A[" & Str(i) & " ] как целое")
Next i
aMax = a(1)
aMin = a(1)
For i = 2 To n
If a(i) > aMax Then aMax = a(i)
If a(i) < aMin Then aMin = a(i)
Next i
MsgBox "Сумма max+min =" & Str(aMax + aMin) & _
" их разность =" & Str(aMax - aMin)
End Sub