虽然已经结贴
还是再补充一种代码吧
还是再补充一种代码吧
程序代码:
#include <stdio.h> #define N 800 #define NOZERO 7 int count(int n); int ten_pow(int n); int main(tmpoid) { int n = 0, i, t, v; while(++n <= N) { t = n; i = count(t); while(i--) { v = ten_pow(i); if(NOZERO == t / v) break; t %= v; } if(t < 10 && t != NOZERO) printf("%d ", n); } return 0; } int count(int n) { int i = 1; while(n >= 10) { n /= 10; i++; } return i; } int ten_pow(int n) { int v = 1; while(n--) v *= 10; return v; }
Only the Code Tells the Truth K.I.S.S