题解 | 牛牛数数
牛牛数数
https://www.nowcoder.com/practice/03a3cc96fa4847b387bf58bb800d67cf
#include <stdbool.h>
#include <stdio.h>
int main() {
int n;
scanf("%d", &n);
for (int i = 1; i <= n; i++){
if ((i % 4 == 0)){
continue;
}
int shu = i;
bool pandun = true;
while (shu) {
if (shu % 10 == 4){
pandun = false;
break;
}
shu /= 10;
}
if (pandun){
printf("%d\n", i);
}
}
return 0;
}

查看11道真题和解析