C# 代码
public class Solution {
public int RotatedDigits(int n) {
int result = 0;
for (int i = 1; i <= n; i++){
if (Check(i)) result++;
}
return result;
}
private bool Check(int x){
bool flag = false;
while (x > 0){
int t = x % 10;
if (t == 3 || t == 4 || t == 7) return false;
if (t == 2 || t == 5 || t == 6 || t == 9) flag = true;
x /= 10;
}
return flag;
}
}