Submission #484280

# Submission time Handle Problem Language Result Execution time Memory
484280 2021-11-02T19:59:18 Z rainboy Sifra (COCI21_sifra) C
50 / 50
1 ms 276 KB
#include <ctype.h>
#include <stdio.h>
#include <string.h>

#define N	100
#define A	1000

int main() {
	static char cc[N + 1], used[A];
	int n, i, j, k;

	scanf("%s", cc), n = strlen(cc);
	k = 0;
	for (i = 0; i < n; i++)
		if (isdigit(cc[i])) {
			int a;

			j = i, a = 0;
			while (j < n && isdigit(cc[j])) {
				a = a * 10 + (cc[j] - '0');
				j++;
			}
			if (!used[a])
				used[a] = 1, k++;
			i = j - 1;
		}
	printf("%d\n", k);
	return 0;
}

Compilation message

Main.c: In function 'main':
Main.c:12:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |  scanf("%s", cc), n = strlen(cc);
      |  ^~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 276 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 276 KB Output is correct