文章
50
粉丝
0
获赞
54
访问
1.5k
#include <iostream>
using namespace std;
int main()
{
int N;
while(cin>>N)
{
int x,y,z;
cin>>x>>y>>z;
int maxprice=0;
int first=0;
int last=0;
for(int i=1;i<10;i++)
for(int j=0;j<10;j++)
{
int guess=i*10000+x*1000+y*100+z*10+j;
if(guess%N==0)
if(guess/N>maxprice)
{
maxprice=guess/N;
first=i;
last=j;
}
}
if(maxprice)
cout<<first<<" "<<last<<" "<<maxprice<<endl;
else
cout<<"0"<<endl;
}
return 0;
}
登录后发布评论
暂无评论,来抢沙发