整数拆段
This commit is contained in:
parent
6953000304
commit
0b2c5f352e
|
@ -0,0 +1,3 @@
|
|||
# 标题
|
||||
|
||||
* 内容
|
|
@ -0,0 +1 @@
|
|||
#
|
Binary file not shown.
|
@ -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;
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
2664256234
|
|
@ -0,0 +1 @@
|
|||
321427
|
|
@ -0,0 +1 @@
|
|||
1234
|
|
@ -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
|
||||
|
Loading…
Reference in New Issue