整数拆段
This commit is contained in:
parent
6953000304
commit
0b2c5f352e
3
1670_numcut(zheng)/Readme.md
Normal file
3
1670_numcut(zheng)/Readme.md
Normal file
@ -0,0 +1,3 @@
|
||||
# 标题
|
||||
|
||||
* 内容
|
1
1670_numcut(zheng)/doc/Readme.md
Normal file
1
1670_numcut(zheng)/doc/Readme.md
Normal file
@ -0,0 +1 @@
|
||||
#
|
BIN
1670_numcut(zheng)/doc/整数拆段.pdf
Normal file
BIN
1670_numcut(zheng)/doc/整数拆段.pdf
Normal file
Binary file not shown.
36
1670_numcut(zheng)/main.cpp
Normal file
36
1670_numcut(zheng)/main.cpp
Normal 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
BIN
1670_numcut(zheng)/main.exe
Normal file
Binary file not shown.
1
1670_numcut(zheng)/test/in.txt
Normal file
1
1670_numcut(zheng)/test/in.txt
Normal file
@ -0,0 +1 @@
|
||||
2664256234
|
1
1670_numcut(zheng)/test/in2.txt
Normal file
1
1670_numcut(zheng)/test/in2.txt
Normal file
@ -0,0 +1 @@
|
||||
321427
|
1
1670_numcut(zheng)/test/in3.txt
Normal file
1
1670_numcut(zheng)/test/in3.txt
Normal file
@ -0,0 +1 @@
|
||||
1234
|
18
1670_numcut(zheng)/test/out.txt
Normal file
18
1670_numcut(zheng)/test/out.txt
Normal 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user