Advertisement
Guest User

Untitled

a guest
Oct 19th, 2019
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1.  
  2. //#include "pch.h"
  3. #include <iostream>
  4. #include <vector>
  5. using namespace std;
  6.  
  7. #define ll long long
  8.  
  9. double sqr(double x) {
  10. return (x * x);
  11. }
  12.  
  13. ostream & operator << (ostream & out, vector<ll> & v) {
  14. for (int i = 0; i < v.size(); i++) {
  15. out << v[i] << ' ';
  16. }
  17. return out;
  18. }
  19.  
  20.  
  21. int step(ll x, int n) {
  22. int y = x;
  23. x = 1;
  24. for (int i = 0; i < n; i++) {
  25. x *= y;
  26. }
  27. return x;
  28. }
  29.  
  30. void LlVec(vector<ll> &a) {
  31. int x = 0;
  32. int h = 1;
  33. vector<char> fc;
  34. char c = getchar();
  35. if (c != '\n' & c != -1) {
  36. if (c == '-') {
  37. h = -1;
  38. c = getchar();
  39. }
  40. while (c != ' ' & c != '\n' & c != -1) {
  41. fc.push_back(c);
  42. c = getchar();
  43. }
  44. int k = fc.size();
  45. for (int i = k - 1; i >= 0; i--) {
  46. x += (fc[i] - 48) * step(10, k - i - 1);
  47. }
  48. x *= h;
  49. a.push_back(x);
  50. do {
  51. cin >> x;
  52. a.push_back(x);
  53. c = getchar();
  54. } while (c != -1 & c != '\n');
  55. }
  56. }
  57.  
  58. int main()
  59. {
  60. vector<ll> a;
  61. LlVec(a);
  62.  
  63. int k = 0;
  64. for (int i = 0; i < a.size(); i++) {
  65. if ((a[i] < k | k == 0) & a[i] % 2 != 0) k = a[i];
  66. }
  67. cout << k;
  68.  
  69.  
  70.  
  71. return 0;
  72.  
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement