#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;
}
Объяснение:
// Внимание! Если программа не работает, обновите версию!
begin
Writeln('*** Матрица А ***');
var a:=MatrRandom(4,7,-50,50); a.Println(4);
Writeln('*** Матрица B ***');
var b:=MatrRandom(4,7,-50,50); b.Println(4);
Writeln(4*a.ColCount*'-');
Writeln('*** Матрица А-B ***');
for var i:=0 to 3 do begin
for var j:=0 to 6 do Write(a[i,j]-b[i,j]:4);
Writeln
end;
end.
Пример
*** Матрица А ***
11 -12 -37 22 3 -8 16
-2 21 31 4 -1 13 20
18 -42 -46 -17 19 8 -14
-26 -32 -2 31 -26 -43 -31
*** Матрица B ***
13 -14 12 -37 2 -12 34
26 25 -47 2 -42 1 -43
44 -6 -1 24 37 -9 -3
-30 3 -29 -39 -11 -8 -14
*** Матрица А-B ***
-2 2 -49 59 1 4 -18
-28 -4 78 2 41 12 63
-26 -36 -45 -41 -18 17 -11
4 -35 27 70 -15 -35 -17