Lucian_Adrian

#1030 SumeProduse

Oct 5th, 2021
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. long long n, a[100001],s1=0,s2=0;
  6. cin >> n;
  7. for (int i = 1 ; i <= n; ++i)
  8. {
  9. cin >> a[i];
  10. }
  11. for (int i = 1 ; i <= n; ++i)
  12. {
  13. if (i <= n/2)
  14. s1+=a[i];
  15. else
  16. s2+=a[i];
  17. }
  18. cout << s1*s2;
  19. return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment