AC的代码如下,未考虑效
#include<iostream> using namespace std; int main() { int N; while(cin>>N) { int max=0; int f1,f2,i,j,x,y,z; cin>>x>>y>>z; for(i=1;i<=9;i++) for(j=0;j<=9;j++) { int sum=i*10000+x*1000+y*100+z*10+j; if (sum%N==0) { int tem; tem=sum/N; if (max<tem) { max=tem; f1=i;f2=j; } } } if (max==0) cout<<0<<endl; else cout<<f1<<" "<<f2<<" "<<max<<endl; } return 0; }
时间: 2024-10-12 04:09:34