1 条题解
-
0
C++ :
#include <stdio.h> #include <algorithm> #include <stack> #include <queue> #include <map> #include <string.h> using namespace std; int dp[1005]; int max(int a,int b) { if(a>b) return a; else return b; } int main() { dp[1]=1; dp[2]=2; dp[3]=3; dp[4]=4; dp[5]=6; int i,j; int maxa=-1; for( i=6;i<=1000;i++) for( j=1;j<i;j++) { maxa=max(maxa,dp[j]*(i-j)); dp[i]=maxa; } int n; while(scanf("%d",&n)!=EOF) { if(n==0) break; printf("%d\n",dp[n]); } return 0; }
- 1
信息
- ID
- 3171
- 时间
- 1000ms
- 内存
- 128MiB
- 难度
- (无)
- 标签
- 递交数
- 0
- 已通过
- 0
- 上传者