답안 #392843

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
392843 2021-04-21T21:55:53 Z rainboy Karte (COCI15_karte) C
50 / 50
1 ms 284 KB
#include <stdio.h>
#include <string.h>

#define N	1000

char suits[] = "PKHT";

int main() {
	static char cc[N + 1], used[52];
	static int kk[4];
	int n, i, s, r;

	scanf("%s", cc), n = strlen(cc) / 3;
	for (s = 0; s < 4; s++)
		kk[s] = 13;
	for (i = 0; i < n; i++) {
		s = strchr(suits, cc[i * 3 + 0]) - suits, r = (cc[i * 3 + 1] - '0') * 10 + (cc[i * 3 + 2] - '0');
		if (used[s * 13 + r]) {
			printf("GRESKA\n");
			return 0;
		}
		used[s * 13 + r] = 1, kk[s]--;
	}
	for (s = 0; s < 4; s++)
		printf("%d ", kk[s]);
	printf("\n");
	return 0;
}

Compilation message

karte.c: In function 'main':
karte.c:13:2: warning: ignoring return value of 'scanf', declared with attribute warn_unused_result [-Wunused-result]
   13 |  scanf("%s", cc), n = strlen(cc) / 3;
      |  ^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 284 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 284 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 280 KB Output is correct
10 Correct 1 ms 204 KB Output is correct