3
, .
: 121
: ..
: ..
2011
1. :
2. 3: Z , |Wn+1 - Wn| < e
Wn+1 = Wn +(1/3)(Z/ Wn2- Wn)
Z/3, Z >= 0 W0= 3 Z Z < 0
F(w) = w + (1/3)(Z/ w2- w)
: Z, , , , .
4. :
#include "stdafx.h"
//#include <stdio.h>
#include <conio.h>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
setlocale(LC_ALL,"russian");
//
float z = 0;
float wn1 = 0;
float wn = 0;
float e = 0;
float x = 0;
//
printf(" Z: ");
scanf("%f",&z);
printf(" ( ): ");
scanf("%f",&e);
//
wn = 0;
wn1 = 0;
if (z < 0)
wn = 3 * z;
else
wn = z / 3;
x = wn;
while (x > e)
{
wn1 = wn + (z / (wn * wn) - wn) / 3;
x = wn1 > wn? wn1 - wn: wn - wn1;
wn = wn1;
//printf("%f %f %f\n", e, x, Wn);
}
printf("%9.2f",wn1);
getchar();
getchar();
return 0;
}
5. :
2. : >0 , |Yn+1 - Yn| < e
Yn+1 = 0.5(Yn +A/Yn) Y0=A
3. :
, , .
4. :
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
setlocale(LC_ALL,"russian");
//
float A=0;
float Yn1=0;
float Yn=0;
float e=0;
float x=0;
//
printf(" : ");
scanf("%f", &A);
printf(" : ");
scanf("%f", &e);
//
Yn = A;
x = A;
while (x > e)
{
Yn1 = (Yn + A/Yn) / 2;
x = Yn1 > Yn? Yn1 - Yn: Yn - Yn1;
Yn = Yn1;
}
printf("%f",Yn);
getchar();
getchar();
return 0;
}
5. :
2. 5: N- , ..
|
|
0 1 1 2 3 5 8 13 21 34
ci= ci-1 + ci-2 (c1 = 0 c2 = 1) n=10 c=34
: , - n- , n- .
4. :
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
setlocale(LC_ALL,"russian");
//
int c=0;
int cp=1; //i-1
int cpp=0; //ci-2
int i=0;
int n=0;
//
printf(" : ");
scanf("%d",&n);
// n-
for (i=3;i<=n;i++)
{
c=cpp+cp;
cpp=cp;
cp=c;
}
printf("%d",c);
getchar();
getchar();
return 0;
}
5. :
2. 7:
N M
(N=23345 M=9135 => 1015 N=238 M=347 => 34)
Nk = Nk-2 - INT(Nk-2 / Nk-1) N k-1 k=2,3...
N0 = max(|N|, |M|) N1 = min(|N|, |M|)
Nk = 0 => = Nk-1
: , N M , , , .
4. :
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
setlocale(LC_ALL,"russian");
//
int N = 0;
int M = 0;
int Npp = 0;// Nk-2
int Np = 0; //Nk-1
int i = 0;
//
printf(" N M: ");
scanf("%d%d",&N,&M);
//
N = N > 0? N: - N;
M = M > 0? M: - M;
//
Npp = N > M? N: M;
Np = N < M? N: M;
//
while (N!= 0)
{
N = Npp - (Npp / Np) * Np;
Npp = Np;
Np = N;
}
//
printf("%d",Npp);
getchar();
getchar();
return 0;
}
5. :
2. : X , X, .
Xi = 1/(Xi-1 - INT(Xi-1))
: - , n- .
4. :
#include "stdafx.h"
#include <stdio.h>
#include <conio.h>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
setlocale(LC_ALL,"russian");
//
int integralpart = 0;
float xi = 0; //Xi
float xi1 = 0; //Xi-1
int i = 0;
int n = 0;
//
printf(" : ");
scanf("%f", &xi1);
printf(" : ");
scanf("%d", &n);
|
|
//
xi = xi1;
for (i=0; i<=n; i++)
{
if (xi1!= integralpart)
{
integralpart = xi/1;
printf("%d, ", integralpart);
xi = 1 / (xi1 - integralpart);
xi1 = xi;
}
}
getchar();
getchar();
return 0;
}
5. :
6. : .