#include using namespace std; bool judge(int n) { int res = n % 3 == 0 ? true : false; while (n != 0) { res = n % 10 == 3 ? true : res; n /= 10; } return res; } int main() { int A, B; cin >> A >> B; for (int i = A; i <= B; i++) { if (judge(i)) { cout << i << endl; } } }