#include using namespace std; int main() { // your code goes here int a, b; cin >> a >> b; for (int i = a; i <= b; i++) { if (i % 3 == 0) { cout << i << endl; continue; } int j = i; // j = 0 に収束する while (j > 0) { // 一桁目を取り出す if (j % 10 == 3) { cout << i << endl; break; } // 桁をずらす j /= 10; } } return 0; }