Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void Divizeaza(int s, int d, int &m)
- {
- m=(s+d)/2;
- }
- int ecuatie(int a,int b,int c,int nr)
- {
- return a*nr*nr+b*nr+c;
- }
- void Dei(int v[100],int s,int d,int a,int b, int c,int &z)
- {
- int m;
- if(s<d)
- {
- Divizeaza(s,d,m);
- Dei(v,s,m,a,b,c,z);
- Dei(v,m+1,d,a,b,c,z);
- }
- else
- if(ecuatie(a,b,c,v[s])==0)
- z++;
- }
- int main()
- {
- int v[100],n,z=0,a,b,c;
- cout<<"a=";cin>>a;
- cout<<"b=";cin>>b;
- cout<<"c=";cin>>c;
- cout<<"n=";cin>>n;
- for(int i=0;i<n;i++)
- cin>>v[i];
- Dei(v, 0, n-1,a,b,c,z);
- cout<<z;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement