Task: | Differences |
Sender: | Team Lewd |
Submission time: | 2019-05-25 12:18:17 +0300 |
Language: | C++ |
Status: | COMPILE ERROR |
Compiler report
input/code.cpp: In function 'int main()': input/code.cpp:20:10: error: expected ')' before ';' token sort(arr2;arr2+a); ^ input/code.cpp:20:17: error: expected ';' before ')' token sort(arr2;arr2+a); ^ input/code.cpp:20:15: warning: statement has no effect [-Wunused-value] sort(arr2;arr2+a); ~~~~^~
Code
#include<iostream> #include<algorithm> using namespace std; int main() { int a=0; cin>>a; int arr[a]; for (int i=0; i<a; i++){ int b; std::cin>>b; arr[i]=b;} std::sort(arr, arr + a); int arr2[a]; for (int ii=0; ii<a; ii++){ int bc; std::cin>>bc; arr2[ii]=bc;} sort(arr2;arr2+a); int v=0; for(int ib=0; ib<a; ib++){ v+=abs(arr[ib]-arr2[ib]);} std::cout<<v; return 0; }