( 2.3)
:
- . , , (x, y) . ,
y = -x, x = 0, y = -1. :
if (y <= -x && x >= 0 && y > -1) cout << YES; else cout << NO; - , . , , :
x > y && x < 2 && y > -1;
x > y && x < 2 || y > -1;
x > y && (x < 2 || y > -1);
x > y || x < 2 && y > -2;
x > y || x < 2 || y > -1;
, , , :
. , , , x*y >=0;
&&, ; , (1, 1), (0, 0), (-1, 1) : y > abs(x) && y <=1;
||, , ; , , 2 , , OY : x > 0 || x*x + y*y <=4;
&&, ||, : , &&; , 2, , OY , 2 3 , :
x <= 0 && x*x + y*y <=4 || x >=0 && x*x + y*y >= 4 && x*x + y*y <=9;
(!), , , ; , 5 , (1,1) (0, 0) (-1, 1):
x*x + y*y <= 25 &&! (y >= abs(x) && y <=1).
. , , . . , . , , : {x2 + y2 <=1} {≤0 y ≤ 0 y ≥ -x-2}
|
|
1
-2 1
-1
-2
int main()
{
double x, y;
cout << " input x, y" << endl;
cin >> x >> y; //
if ( (x * x + y * y <= 1) || (x <= 0 && y <= 0 && y >= -x - 2) )
cout << "YES" << endl;
else cout << "NO" << endl;
_getch();
return 0;
}
bool b =(x * x + y * y <= 1) || (x <= 0 && y <= 0 && y >= -x - 2);
if (b) cout << "YES" << endl;
else cout << "NO" << endl;
:
cout <<
((( x * x + y * y <= 1 ) || ( x <= 0 && y <= 0 && y >= -x - 2 ))? "Yes": "No" );
bool b =(x * x + y * y <= 1) || (x <= 0 && y <= 0 && y >= -x - 2);
cout << (b? "Yes": "No" );
-----------------------------------------------------------------------------------------
a, b, c. :
int main() //
{
Bool a, b, c, d;
a = true; b = true; c = false;
d = a && (!(b && (!c)));
cout << d << endl; // 0
_getch();
return 0;
}
-----------------------------------------------------------------------------------------
int main() //
{
Double a, b, c, d;
a = 1.2; b = -2.3; c = 0;
d = a && (!(b && (!c)));
cout << d << endl; // 0
_getch();
return 0;
}
-----------------------------------------------------------------------------------------
int main() //
{
Int a, b, c, d;
a = -1; b = -2; c = 1;
d = a && (!(b && (!c)));
cout << d << endl; // 1
_getch();
return 0;
}
-----------------------------------------------------------------------------------------
a, b, c:
a || b && c
int main() //
{
Bool a, b, c, d;
Int ia, ib, ic;
printf(" input a, b, c:\n");
printf("!=0 - true, ==0 - false:\n");
scanf_s("%i %i %i", &ia, &ib, &ic); //
a = bool(ia); b=bool(ib); c = bool(ic); //
|
|
d = a || b && c;
printf("d = %d \n ", d);
_getch();
return 0;
}
:
1 1 1
d= 1
-----------------------------------------------------------------------------------------
b , n k :
#include <stdio.h> //
#include <conio.h>
int main()
{
Int n, k;
Bool b;
printf("input n,k:\n");
scanf_s("%i %i", & n, & k);
b = (n % 2 == k % 2);
if (b) printf("odin");
else printf("razn");
printf("\nb==%d \n ", b);
_getch();
return 0;
}
:
input n,k:
4 8
odin
b==1
-----------------------------------------------------------------------------------------