답안 #171779

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
171779 2019-12-30T11:41:40 Z ToniB Karte (COCI15_karte) C++14
15 / 50
2 ms 504 KB
#include <iostream>
#include <algorithm>
#include <string>

using namespace std;

int main(){
    string s;
    cin >> s;
    
    int h[13] = {0}, k[13] = {0}, t[13] = {0}, p[13] = {0}, ukh = 0, ukt = 0, ukp = 0, ukk = 0;
    
    for(int i = 0; i < s.length(); ++i){
    	int des = s[i + 1];
    	int jed = s[i + 2];
    	
    	des -= 48;
    	jed -= 48;
    	
    	int ind = des * 10 + jed;
    	
    	if(s[i] == 'K') k[ind] += 1; 
    	if(s[i] == 'H') h[ind] += 1; 
    	if(s[i] == 'P') p[ind] += 1; 
    	if(s[i] == 'T') t[ind] += 1;
    	
    	i += 2;
	}
	
	for(int i = 0; i < 13; ++i){
		ukh += h[i]; ukp +=  p[i]; ukk += k[i]; ukt += t[i];
		
		if(h[i] > 1 or p[i] > 1 or t[i] > 1 or k[i] > 1){
			cout << "GRESKA";
			return 0;
		}
		
	}
	
	cout << 13 - ukp << " " << 13 - ukk << " " << 13 - ukh << " " << 13 - ukt;
	
	return 0;
}

Compilation message

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