整数拆段(未完成)
This commit is contained in:
parent
ef43e42fd4
commit
0b327c4df4
|
@ -0,0 +1,16 @@
|
|||
# 1670 『入门』(递归专题)整数拆段
|
||||
|
||||
[问题描述]
|
||||
将一个位数为L(4≤L≤10)的自然数N拆成4段,使各段对应的数的乘积最小。你能编一个程序实现吗?
|
||||
|
||||
[输入格式]
|
||||
一个自然数N。
|
||||
|
||||
[输出格式]
|
||||
一个整数,最小乘积。
|
||||
|
||||
[输入样例]
|
||||
321427
|
||||
|
||||
[输出样例]
|
||||
2268
|
|
@ -0,0 +1 @@
|
|||
#
|
|
@ -0,0 +1,21 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
int ans=0,nowans=1;
|
||||
void xiao(int now,int duan){
|
||||
if(duan==1){
|
||||
if(ans==0||nowans<ans){
|
||||
ans=nowans;
|
||||
return ;
|
||||
}
|
||||
}else{
|
||||
for(int i=10;;i*=10){
|
||||
if(now)
|
||||
}
|
||||
}
|
||||
}
|
||||
int main()
|
||||
{
|
||||
int n;
|
||||
cin>>n;
|
||||
xiao(n,4);
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,7 @@
|
|||
## z:\Chao\src\Template\test\in.txt
|
||||
2020/03/14 ÖÜÁù 11:41:28.68
|
||||
Hello Easy C++ project!
|
||||
|
||||
-----------------------------------------------
|
||||
Process exited after 200 ms with return value 0
|
||||
|
Loading…
Reference in New Issue