|
|
back to boardwhat is wrong with the solution??? С++ #include <iostream> using namespace std; int main() { int n,c; cin>>n; int a[n]; for(int i=0;i<n;i++) cin>>a[i]; for(int i=0;i<n;i++){ for(int j=0;j<n;j++) if(a[i]<a[j]){c=a[i];a[i]=a[j];a[j]=c;} } c=a[n-1]; for(int i=0;i<n;i++) c=c+a[i]; cout<<c; return 0; } Edited by author 25.03.2022 06:30 |
|
|