fork(1) download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. // your code goes here
  6. int n;
  7. cin>>n;
  8. vector<int>v(n);
  9. for(int i=0;i<n;i++){
  10. cin>>v[i];
  11. }
  12. sort(v.begin(),v.end());
  13. for(int i=n-1;i<)
  14. v.erase(v.begin()+n-1);
  15.  
  16. int sum=0;
  17. int x=accumulate(v.begin(),v.end(),sum);
  18. cout<<x;
  19.  
  20. return 0;
  21. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
8
15 -2 2 -8 1 7 10 23
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:13:18: error: expected primary-expression before ‘)’ token
  for(int i=n-1;i<)
                  ^
prog.cpp:13:18: error: expected ‘;’ before ‘)’ token
  for(int i=n-1;i<)
                  ^
                  ;
stdout
Standard output is empty