답안 #153867

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
153867 2019-09-17T05:52:03 Z vladciuperceanu Karte (COCI15_karte) C++14
50 / 50
3 ms 376 KB
#include <iostream>

using namespace std;

int i,a[10][20],nr[10];
char s[1005];

int main()
{
    cin >> s; int ok = 0;
    for (i=0; s[i]!=0; i+=3)
    {
        int val = 0;
        if (s[i] == 'P')
            val = 1;
        if (s[i] == 'K')
            val = 2;
        if (s[i] == 'H')
            val = 3;
        if (s[i] == 'T')
            val = 4;
        int num = (s[i+1]-'0')*10+(s[i+2]-'0');
        if (a[val][num] == 0)
            a[val][num] = 1;
        else
        {
            ok = 1;
            break;
        }
    }
    if (ok == 1)
    {
        cout << "GRESKA";
        return 0;
    }
    for (i=1; i<=13; i++)
    {
        if (a[1][i] == 1)
            nr[1]++;
        if (a[2][i] == 1)
            nr[2]++;
        if (a[3][i] == 1)
            nr[3]++;
        if (a[4][i] == 1)
            nr[4]++;
    }
    cout << 13-nr[1] << " " << 13-nr[2] << " " << 13-nr[3] << " " << 13-nr[4];
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct