-
Notifications
You must be signed in to change notification settings - Fork 2
/
wolf.cpp
63 lines (63 loc) · 1.01 KB
/
wolf.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <iostream>
#include <vector>
using namespace std;
int main()
{
int cards;
int value;
char suit;
vector<int> c;
vector<int> s;
vector<int> h;
vector<int> d;
cin >> cards;
if (cards < 26) {
cout << "impossible";
}
else if(cards > 26){
cout << "possible";
}
else{
for (int i = 0; i < 26; i++) {
cin >> value >> suit;
if (suit == 'C') {
c.push_back(value);
}
if (suit == 'S') {
s.push_back(value);
}
if (suit == 'H') {
h.push_back(value);
}
if (suit == 'D') {
d.push_back(value);
}
}
for (int i = 0; i < c.size(); i++) {
if (c[i] != i + 1) {
cout << "possible";
return 0;
}
}
for (int i = 0; i < s.size(); i++) {
if (s[i] != i + 1) {
cout << "possible";
return 0;
}
}
for (int i = 0; i < h.size(); i++) {
if (h[i] != i + 1) {
cout << "possible";
return 0;
}
}
for (int i = 0; i < d.size(); i++) {
if (d[i] != i + 1) {
cout << "possible";
return 0;
}
}
cout << "impossible";
}
return 0;
}