#include using namespace std; int main() { int A,B; cin >> A >> B; for (int i=A;i<=B;i++){ //int str = i; string str = to_string(i); int threepos = -1; threepos = str.find_first_of('3'); // 3の倍数ならば… if (i % 3 == 0){ cout << i << endl; } // 3がつくならば… else if (threepos >= 0){ cout << i << endl; } } //cout << result.at(dif) << endl; return 0; }