Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- /*int n;
- cin >> n;
- int a, p;
- int temp = 2;
- int temp2 = temp;
- bool escape = false;
- for (int q = temp; ; q++)
- {
- for (int i = n / 2; i > 1; i--)
- {
- int max = (temp + i - 1);
- for (int j = temp + 1; j <= max; j++)
- {
- temp += j;
- }
- if (temp == n) {
- cout << temp2 << " " << i;
- escape = true;
- break;
- }
- else temp = temp2;
- }
- if (escape == true)
- break;
- }
- */
- /*
- int n;
- cin >> n;
- int after = n;
- int mas[60001];
- for (int i = 0; i < n; i++)
- {
- cin >> mas[i];
- }
- for (int i = 1; i < n; i++)
- {
- if (mas[i] < mas[i - 1])
- {
- after--;
- }
- }
- cout << after << '\n';
- for (int i = 0; i < n; i++)
- {
- if (mas[i] != -1)
- cout << mas[i] << " ";
- }
- cin.unget();
- */
- int mas[5];
- int same = 0;
- int pair = 0;
- int three_of_kind = 0;
- for (int i = 0; i < 5; i++)
- {
- cin >> mas[i];
- }
- bool checked[5]{ false };
- for (int i = 0; i < 5; i++)
- {
- for (int j = 0; j < 5; j++)
- {
- if (mas[i] == mas[j] && i != j && checked[j] == false)
- {
- same++;
- checked[i] = true; checked[j] = true;
- }
- }
- if (same == 1) pair++;
- else if (same == 2) three_of_kind++;
- }
- cout << pair << three_of_kind;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement