Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int n;
- float t[101];
- float maxim(int s, int d)
- {
- if(s==d)
- return t[s];
- if(s<d)
- {
- int m=(s+d)/2;
- float max1, max2;
- max1 = maxim(s,m);
- max2 = maxim(m+1, d);
- if(max1<max2)
- return max2;
- return max1;
- }
- }
- int main()
- {
- cin>>n;
- for(int i=1; i<=n; i++)
- cin>>t[i];
- cout<<maxim(1, n);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement