#include<bits/stdc++.h> using namespace std; int main(){ int a=1,n=999,w,c; while(a<=n){ c=a; while(c>0){ w=c%10; c=c/10; if(w==5){ if(a%3==0){ cout<<a<<endl; break; } } } a++; } } /************************************************************** Problem: 1059 User: lvrenxiang Language: C++ Result: Accepted Time:7 ms Memory:2072 kb ****************************************************************/