|
|
back to boardCompilation error. WHY? It work in dev c++: #include <iostream> using namespace std; int main(){ int a; cin>>a; int b[a]; int tmp; int q=0; for(int i=0; i<a; i++){ cin>>b[i]; } for(int i = 0; i < a - 1; ++i) // i - íîìåð ïðîõîäà { for(int j = 0; j < a - 1; ++j) // âíóòðåííèé öèêë ïðîõîäà { if (b[j + 1] < b[j]) { tmp = b[j + 1]; b[j + 1] = b[j]; b[j] = tmp; } } } if (a%2==0){
for (int z=0; z<(a/2)+1;z++){ if(b[z]%2==0) q+=(b[z]/2)+1; else q+=(b[z]+1)/2;
} } else { int r=(a+1)/2; for (int z=0; z<r;z++){ if(b[z]%2==0) q+=(b[z]/2)+1; else q+=(b[z]+1)/2;
} }
cout<<q; return 0; } |
|
|