.


:




:

































 

 

 

 


, .




, , 25 (25 * 25 = 6 25).

 

#include <iostream>

#include <iomanip>

#include <math.h>

#include <conio.h>

#include <windows.h>

using namespace std;

 

bool Automorfnoe(long n)

{

long copy = n; // n

long m = 1; /* m, 10, n, 25 m = 100 */

do

{

m *= 10;

copy /= 10;

} while(copy);

if ((n*n % m) == n) /* n m , n, , c n , */

return true;

else return false;

}

 

 

int main()

{

if(SetConsoleCP(1251)==0

{

cerr<<"Fialed to set codepage!"<<endl;

}

if(SetConsoleOutputCP(1251)==0)

{

cerr<<"Failed to set OUTPUT page!"<<endl;

}

do

{

long m;

cout<< " ";

cin>> m;

// n, m:

long n = m+1; //

bool flag = true;

while (!Automorfnoe(n)) //

{

n++; //

if (n > 1e5) { flag = FALSE; break;}

/* , , */

}

if (flag) // , true, ,

cout<< " - " << n << ": " << n <<" = " << n * n << endl;

else cout<< " \n";

} while (_getch()!= 27);

return 0;

}

5. y= ax+b y = c/x +d

( )

 

:

 

a 0, , .

 

#include <iostream>

#include <iomanip>

#include <math.h>

#include <conio.h>

#include <windows.h>

using namespace std;

/* Root(), , : */

void Root(double a, double b, double c, double& x1, double& x2, byte& k);

void Root(double a, double b, double& x, byte& k);

//

int main()

{

if(SetConsoleCP(1251)==0)

//

{

cerr<<"Fialed to set codepage!"<<endl;

}

if(SetConsoleOutputCP(1251)==0)

{

cerr<<"Failed to set OUTPUT page!"<<endl;

}

double a, b, c, d;

double x1, y1, x2, y2;

byte k; //

do

{

cout<< " a b c d ";

cin>> a >> b >> c >> d;

if (a) // 0,

Root(a, b-d, -c, x1, x2, k);

//

else // :

Root(b-d, -c, x1, k);

// k :

switch(k)

{

case 3: cout<< " \n"; break;

case 2: y1 = a*x1 + b; y2 = a*x2 + b;

cout<<" 2 : " <<setprecision(2)<< x1 << ',' << y1 << " " << x2 << ',' << y2 << endl; break;

case 1: y1 = a*x1+ b;

cout<<" "<<setprecision(2)<< x1 << ',' << y1 << endl; break;

default: cout<<" \n";

}

} while (_getch()!= 27);

return 0;

}

//

void Root(double a, double b, double c, double& x1, double& x2, byte& k)

{

double d = b*b - 4*a*c;

if (d > 0)

{

k = 2;

x1 = (-b + sqrt(d)) / (2*a);

x2 = (-b - sqrt(d)) / (2*a);

if (x1==0 || x2 == 0) k = 1;

// x

if (x1 == 0) x1 = x2; /* , x1 */

}

else if (d == 0)

{

x1 = -b / (2*a);

k = 1;

if (x1 == 0) k = 0;

}

else k = 0;

}

//

void Root(double a, double b, double& x, byte& k)

{

if (a)

{

k = 1;

x = -b / a;

if (x == 0) k = 0;

}

else if (b) k = 0;

else k = 3;

}





:


: 2016-11-24; !; : 689 |


:

:

, , .
==> ...

1781 - | 1465 -


© 2015-2024 lektsii.org - -

: 0.011 .