답안 #704692

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
704692 2023-03-02T15:57:46 Z delrey Karte (COCI15_karte) C++14
50 / 50
1 ms 296 KB
#include <bits/stdc++.h>

using namespace std;

bool k[4][20];
int kn[4] = {13, 13, 13, 13};

int main()
{
    string s;
    cin>>s;
    int n = s.length();
    for(int i = 0; i < n; i += 3)
    {
        int num = (s[i + 1] - '0') * 10 + (s[i + 2] - '0'), suit;
        if(s[i] == 'P')
            suit = 0;
        if(s[i] == 'K')
            suit = 1;
        if(s[i] == 'H')
            suit = 2;
        if(s[i] == 'T')
            suit = 3;
        if(k[suit][num])
        {
            cout<<"GRESKA"<<endl;
            return 0;
        }
        k[suit][num] = true;
        kn[suit]--;
    }
    for(int i = 0; i < 4; i++)
        cout<<kn[i]<<" ";
    return 0;
}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:24:23: warning: 'suit' may be used uninitialized in this function [-Wmaybe-uninitialized]
   24 |         if(k[suit][num])
      |            ~~~~~~~~~~~^
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 296 KB Output is correct