Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.67 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.    
  7.     /*int n;
  8.     cin >> n;
  9.     int a, p;
  10.     int temp = 2;
  11.     int temp2 = temp;
  12.     bool escape = false;
  13.     for (int q = temp; ; q++)
  14.     {
  15.         for (int i = n / 2; i > 1; i--)
  16.         {
  17.             int max = (temp + i - 1);
  18.  
  19.             for (int j = temp + 1; j <= max; j++)
  20.             {
  21.                 temp += j;
  22.             }
  23.             if (temp == n) {
  24.                 cout << temp2 << " " << i;
  25.                 escape = true;
  26.                 break;
  27.             }
  28.             else temp = temp2;
  29.         }
  30.         if (escape == true)
  31.             break;
  32.     }
  33.     */
  34.     /*
  35.     int n;
  36.     cin >> n;
  37.     int after = n;
  38.     int mas[60001];
  39.     for (int i = 0; i < n; i++)
  40.     {
  41.         cin >> mas[i];
  42.     }
  43.     for (int i = 1; i < n; i++)
  44.     {
  45.         if (mas[i] < mas[i - 1])
  46.         {
  47.            
  48.             after--;
  49.         }
  50.     }
  51.     cout << after << '\n';
  52.     for (int i = 0; i < n; i++)
  53.     {
  54.         if (mas[i] != -1)
  55.             cout << mas[i] << " ";
  56.     }
  57.     cin.unget();
  58.     */
  59.     int mas[5];
  60.     int same = 0;
  61.     int pair = 0;
  62.     int three_of_kind = 0;
  63.     for (int i = 0; i < 5; i++)
  64.     {
  65.         cin >> mas[i];
  66.     }
  67.     bool checked[5]{ false };
  68.     for (int i = 0; i < 5; i++)
  69.     {
  70.         for (int j = 0; j < 5; j++)
  71.         {
  72.             if (mas[i] == mas[j] && i != j && checked[j] == false)
  73.             {
  74.                 same++;
  75.                 checked[i] = true; checked[j] = true;
  76.             }
  77.         }
  78.         if (same == 1) pair++;
  79.         else if (same == 2) three_of_kind++;
  80.     }
  81.     cout << pair << three_of_kind;
  82.    
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement