#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
#include <vector>
#include <queue>
typedef long long ll;
using namespace std;
int pot (ll q, ll w){
ll qw = q;
q = 1;
for (int i = 0; i<w; i++)
q*= qw;
return q;
}
string s;
ll gr,rj,pd[14],kd[14],hd[14],td[14],p,k,h,t;
int main () {
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
cin >> s;
ll c = s.size();
for (int i = 0; i<c;i+=3){
string str;
for (int k = 0; k<3;k++){
str+=s[i+k];
}
if (str[0] == 'P'){
ll a = int(str[1]-'0');
ll b = int(str[2]-'0');
ll broj = a*10+b;
if (pd[broj] == 0)
pd[broj]++;
else
gr=1;
}
else if (str[0] == 'K'){
ll a = int(str[1]-'0');
ll b = int(str[2]-'0');
ll broj = a*10+b;
if (kd[broj] == 0)
kd[broj]++;
else
gr=1;
}
else if (str[0] == 'H'){
ll a = int(str[1]-'0');
ll b = int(str[2]-'0');
ll broj = a*10+b;
if (hd[broj] == 0)
hd[broj]++;
else
gr=1;
}
else if (str[0] == 'T'){
ll a = int(str[1]-'0');
ll b = int(str[2]-'0');
ll broj = a*10+b;
if (td[broj] == 0)
td[broj]++;
else
gr=1;
}
}
if (gr==1)
cout<<"GRESKA";
else{
for (int i = 0;i<14;i++){
if(pd[i] == 0)
p++;
if(kd[i] == 0)
k++;
if(hd[i] == 0)
h++;
if(td[i] == 0)
t++;
}
cout << p-1 << " " << k-1 << " " << h-1 << " " << t-1;
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
4 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |