fork download
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. int size, a;
  8. cin >> size;
  9.  
  10. long *arr1 = new long[size];
  11. long *arr2 = new long[size];
  12. for(int i = 0; i < size; i++){
  13. cin >> arr1[i];
  14. }
  15. for(int i = 0; i < size; i++){
  16. cin >> arr2[i];
  17. }
  18. long tmp = 0;
  19. for(int i = 0; i < size; i++){
  20. tmp+= abs(arr2[i] - arr1[i]);
  21. }
  22. cout << tmp/2;
  23. delete []arr1;
  24. delete []arr2;
  25. return 0;
  26. }
Success #stdin #stdout 0s 4396KB
stdin
Standard input is empty
stdout
Standard output is empty