题解 | #游游的数字圈#
游游的数字圈
https://www.nowcoder.com/practice/16eafa41a4a242b8870cb2c5420ae089
#include <stdio.h> #include <string.h> int f(char *str) { int n = 0; int length = strlen(str); for (int i = 0; i < length; i++) { char c = str[i]; switch (c) { case '0': case '6': case '9': n += 1; break; case '8': n += 2; break; default: break; } } return n; } int main() { char str[100001]; scanf("%s", str); int n = f(str); printf("%d", n); return 0; }