|
|
вернуться в форумHELP, WA#6 Послано 5iqman 16 ноя 2023 23:06 #include<iostream> #include<vector> #include<algorithm> using namespace std; int main() { int n, sum1, sum2= 0; cin >> n; vector<int>dsds(n); for (int i = 0; i < dsds.size(); i++) { cin >> dsds[i]; }
vector<int> dsds2 = dsds; sort(dsds2.begin(), dsds2.end()); sum1 = dsds2[n - 1] + dsds2[n - 2] + dsds2[n - 3]; for (int i = 0; i < dsds.size(); i++) { if (dsds[i] == dsds2[n - 1] || dsds[i] == dsds2[n - 2] || dsds[i] == dsds2[n - 3]) { sum2 = i + 2; break; } } cout << sum1 << " " << sum2; return 0; } in my tests this code works 100%, but i dont know why i have WA#6 Edited by author 16.11.2023 23:08 |
|
|