Advertisement
semsem_elazazy

https://codeforces.com/group/n3sTiYtHxI/contest/348902/problem/K

Mar 17th, 2022
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.77 KB | None | 0 0
  1. #include <iostream>
  2. #include<bits/stdc++.h>
  3. #define ll long long
  4. #define ull unsigned long long
  5. #define pi  3.14159
  6. //#define ceil(w, m) (((w) / (m)) + ((w) % (m) ? 1 : 0))
  7. using namespace std;
  8.  
  9. void yasmeen_fakhri(){
  10.   ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
  11.   #ifndef ONLINE_JUDGE  
  12.     freopen("input.txt", "r", stdin), freopen("output.txt", "w", stdout);
  13.   #endif
  14. }
  15.  
  16. ll maxx = INT_MIN;
  17. ll max_number(ll arr[] , ll n){
  18.     if (n<0 ) return 0;
  19.     if (arr[n] > max_number(arr , n-1) )
  20.     maxx = arr[n];
  21.     return maxx;
  22. }
  23. int main() {
  24.    yasmeen_fakhri();
  25.  
  26. int test =1;
  27. //cin>>test;
  28. while(test--){
  29.  
  30. ll  n;  cin>>n;
  31. ll  arr[n];
  32. for(int i =0 ; i<n ; i++){
  33.     cin>>arr[i];
  34. }
  35. cout<< max_number(arr , n-1);
  36.  
  37. }
  38. return 0;
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement