답안 #154269

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
154269 2019-09-19T20:13:58 Z mihaican Karte (COCI15_karte) C++14
50 / 50
2 ms 376 KB
#include <iostream>
#include <string.h>
using namespace std;
int p=13,k=13,h=13,t=13,pv[15],kv[15],hv[15],tv[15],nr;
char s[1010],c1,c2,x;
int main(){
    cin>>s;
     for(int i=0;i<strlen(s);i+=3){
        x=s[i];
        c1=s[i+1];
        c2=s[i+2];
        nr=(c1-'0')*10+c2-'0';
        if(x=='P'){
            pv[nr]++;
            p--;
        }
        if(x=='K'){
            kv[nr]++;
            k--;
        }
        if(x=='H'){
            hv[nr]++;
            h--;
        }
        if(x=='T'){
            tv[nr]++;
            t--;
        }
        if(pv[nr]>1||hv[nr]>1||hv[nr]>1||tv[nr]>1){
            cout<<"GRESKA";
            return 0;

        }

    }
    cout<<p<<" "<<k<<" "<<h<<" "<<t;

}

Compilation message

karte.cpp: In function 'int main()':
karte.cpp:8:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
      for(int i=0;i<strlen(s);i+=3){
                  ~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct