|
|
вернуться в форумWhy wrong answer? #include <iostream> #include <vector> #include <algorithm> using namespace std; int main() { int a; int n; cin >> n; vector<int> v; for (int i = 0; i < n; i++) { cin >> a; v.push_back(a); } n = 0; sort(v.rbegin(), v.rend()); for (int i = v.size()-1; i > (v.size()-2) / 2; i--) n += (v[i]+1)/2; cout << n << endl; } Re: Why wrong answer? Послано samio 21 фев 2020 01:55 You should iterate from v.begin to v.end. No the reverse way. |
|
|