Advertisement
gilzean

Untitled

May 22nd, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.54 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define NMax 105
  3.  
  4. using namespace std;
  5.  
  6. int A[2][NMax];
  7.  
  8. int main() {
  9. int N;
  10. cin >> N;
  11. for (int i = 0; i < 2; i++) {
  12. for (int j = 0; j < N; j++) {
  13. cin >> A[i][j];
  14. }
  15. }
  16.  
  17. int ans = 0;
  18. for (int i = 0; i < N; i++) {
  19. int tmp = 0;
  20. for (int j = 0; j <= i; j++) {
  21. tmp += A[0][j];
  22. }
  23. for (int j = i; j < N; j++) {
  24. tmp += A[1][j];
  25. }
  26. ans = max(ans, tmp);
  27. }
  28.  
  29. cout << ans << endl;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement