Advertisement
Guest User

Untitled

a guest
Jan 29th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6. setlocale(0, "");
  7. int P = 0, M, N;
  8.  
  9. cout << "Размеры листа:" << endl;
  10. cin >> M >> N;
  11.  
  12. for (int i = 0; i < M; i++)
  13. {
  14. for (int j = 0; j < N; j++)
  15. P += (M - i) * (N - j);
  16. }
  17. cout << "Кол-во возможных вырезанных прямоугольников: " << P;
  18. }
  19.  
  20.  
  21.  
  22. #include <iostream>
  23. #include <ctime>
  24. #include <algorithm>
  25. #include <list>
  26. using namespace std;
  27. int podr(int mas[9])
  28. {
  29. int max = 0, maxl = 0;
  30. if (mas[0] == 6)
  31. max++;
  32. max = maxl;
  33. for (int i = 1; i < 9; i++)
  34. if (mas[i] == 6)
  35. {
  36. if (mas[i] == 6)
  37. maxl++;
  38. if (maxl > max)
  39. max = maxl;
  40. }
  41. else maxl = 0;
  42. return(max);
  43. }
  44.  
  45. void sp4()
  46. {
  47. setlocale(0, "");
  48. int t, n;
  49. cout << "Введите кол-во свободных мест: ";
  50. cin >> n;
  51. int kupe[9];
  52. for (int i = 0; i < 9; i++)
  53. kupe[i] = 0;
  54. cout << "Введите номера свободных мест: \n";
  55. for (int i = 0; i < n; i++)
  56. {
  57. cin >> t;
  58. if (t <= 36) kupe[(t - 1) / 4] ++;
  59. if (t >= 37) kupe[8 - (t - 37) / 2] ++;
  60. }
  61. cout << podr(kupe);
  62. }
  63. void main()
  64. {
  65. sp4();
  66. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement