#include <cmath>
#include <iostream>
#include <clocale>
using namespace std;
double f(double x){
	double f;
	f = 2*cos(3*x)+3*pow(sin(x),2)-pow(x,2)+3*x;
	return f;
}
double f1(double x){
	double f1;
	f1 = 3-2*x+6*cos(x)*sin(x)-6*sin(3*x);
	return f1;
}
int main()
{
	setlocale(LC_ALL,"Rus");
	double a, b, e, x;
	int k;
	a = 1;
	b = 4;
	e = 0.001;
	if(f(a)*f1(a)>0){
		cout<<"Условия сходства выполнены для x=a="<<a<<endl;
		x = a;
	}
	else{
		if(f(b)*f1(b)>0){
		cout<<"Условия сходства выполнены для x=b="<<b<<endl;
		x = b;
		}
		else{
		cout<<"Условия не выполнено";
		x=-10E10;
		}
	}
	if(x>-10E10){
		k=0;
		while(1){
			x=x-f(x)/f1(x);
			k=k+1;
			if(fabs(f(x))<e)break;
		}
		cout<<"Решения x="<<x<<endl;
		cout<<"Количество итераций k="<<k<<endl;
	}
}
