直接枚举就可以了。
#include <iostream> #include <cstdio> #include <algorithm> #include <vector> using namespace std; int a,b; vector<int> ans; int main(){ while(scanf("%d%d",&a,&b)!=EOF){ if(a==0&&b==0) break; ans.clear(); for(int i=a*100;i<=a*100+99;i++){ if(i%b==0){ int tmp=i-a*100; ans.push_back(tmp); } } if(ans[0]<10) printf("0%d",ans[0]); else printf("%d",ans[0]); for(int i=1;i<ans.size();i++) if(ans[i]<10) printf(" 0%d",ans[i]); else printf(" %d",ans[i]); printf("\n"); } return 0; }
时间: 2024-10-11 05:36:59