Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int v[100];
- void citire (int n)
- {
- for (int i=1;i<n+1;i++)
- cin>>v[i];
- }
- int f (int s, int d)
- {
- if (s==d)
- {
- if(v[s]<0)
- return 1;
- else return 0;
- }
- else {
- int m=(s+d)/2;
- return f(s, m)+f(m+1, d);
- }
- }
- int main()
- {
- int n;
- cin>>n;
- citire(n);
- int x=f(1,n);
- if (x==n)
- cout<<"doar negative";
- else {
- if (x==0)
- cout<<"doar pozitive";
- else cout<<"pozitive si negative";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement