整数拆段

This commit is contained in:
James 2020-07-22 10:53:16 +08:00
parent 6953000304
commit 0b2c5f352e
9 changed files with 61 additions and 0 deletions

View File

@ -0,0 +1,3 @@
# 标题
* 内容

View File

@ -0,0 +1 @@
#

Binary file not shown.

View File

@ -0,0 +1,36 @@
#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;
}

BIN
1670_numcut(zheng)/main.exe Normal file

Binary file not shown.

View File

@ -0,0 +1 @@
2664256234

View File

@ -0,0 +1 @@
321427

View File

@ -0,0 +1 @@
1234

View File

@ -0,0 +1,18 @@
## z:\Chao\src\1670_numcut\test\in.txt
2020/07/22 ÖÜÈý 10:42:07.83
46374912
-----------------------------------------------
Process exited after 180 ms with return value 0
## z:\Chao\src\1670_numcut\test\in2.txt
2020/07/22 ÖÜÈý 10:42:07.83
2268
-----------------------------------------------
Process exited after 90 ms with return value 0
## z:\Chao\src\1670_numcut\test\in3.txt
2020/07/22 ÖÜÈý 10:42:07.83
24
-----------------------------------------------
Process exited after 90 ms with return value 0