37 lines
860 B
C++
37 lines
860 B
C++
#include <iostream>
|
|
using namespace std;
|
|
int main()
|
|
{
|
|
long long a[11],all=0,da[11][11]={0};
|
|
char u;
|
|
while(cin>>u){
|
|
all++;
|
|
a[all]=u-'0';
|
|
}
|
|
// for(int i=1;i<=all;i++){
|
|
// cout<<a[i]<<" ";
|
|
// }
|
|
// cout<<endl;
|
|
for(int i=1;i<=all;i++){
|
|
for(int j=1;j<=i;j++){
|
|
da[i][j]=da[i-1][j]*10+a[i];
|
|
// cout<<da[i][j]<<" ";
|
|
}
|
|
// cout<<endl;
|
|
}
|
|
long long ans=-1;
|
|
for(int i=1;i<=all-3;i++){
|
|
for(int j=i+1;j<=all-2;j++){
|
|
for(int k=j+1;k<=all-1;k++){
|
|
long long now=da[all][k+1]*da[k][j+1]*da[j][i+1]*da[i][1];
|
|
// cout<<now<<endl;
|
|
if(now<ans||ans==-1){
|
|
ans=now;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
cout<<ans;
|
|
return 0;
|
|
}
|