답안 #441658

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
441658 2021-07-05T17:39:42 Z rainboy Tavan (COCI16_tavan) C
80 / 80
1 ms 284 KB
#include <stdio.h>
#include <string.h>

#define N	500
#define A	26

int main() {
	static char cc[N + 1], ok[N][A];
	int n, m, k, x, l, g, h, i, a;

	scanf("%d%d%d%d%s", &n, &m, &k, &x, cc), x--;
	for (h = 0; h < m; h++) {
		static char s[A + 1];

		scanf("%s", s), l = strlen(s);
		for (g = 0; g < l; g++)
			ok[h][s[g] - 'a'] = 1;
	}
	for (i = n - 1, h = m - 1; i >= 0; i--)
		if (cc[i] == '#') {
			int d = x % k;

			for (a = 0; a < A; a++)
				if (ok[h][a] && d-- == 0) {
					cc[i] = a + 'a';
					break;
				}
			x /= k, h--;
		}
	printf("%s\n", cc);
	return 0;
}

Compilation message

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