Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. //122945BV
  2.  
  3. #include <iostream>
  4. #include <string>
  5. #include <vector>
  6. #include <stdio.h>
  7. #include <algorithm>
  8.  
  9. #define sz(a) (int)a.size()
  10.  
  11. using namespace std;
  12.  
  13. const int SIZE = 1000;
  14. const int INF = 1000 * 1000 * 1000;
  15.  
  16. void prepare(string s) {
  17. #ifdef _DEBUG
  18. freopen("input.txt", "r", stdin);
  19. #else
  20. if (sz(s) != 0) {
  21. freopen((s + ".in").c_str(),"r",stdin);
  22. freopen((s + ".out").c_str(),"w",stdout);
  23. }
  24. #endif
  25. }
  26.  
  27. vector <int> a;
  28. int n;
  29.  
  30. int main() {
  31.  
  32. prepare("");
  33.  
  34. int tmp;
  35. //freopen("input.txt", "r", stdin);
  36. prepare("");
  37.  
  38. cin >> n;
  39. for (int i = 0; i < n; i++) {
  40. cin >> tmp;
  41. a.push_back(tmp);
  42. }
  43.  
  44. sort(a.begin(), a.end());
  45.  
  46. cout << a[n - 1] + a[n - 2] + a[n - 3] << " " << n - 2 << endl;
  47.  
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement