Ural 1073 Square Country (DP)
来源:互联网 发布:中国零售业 知乎 编辑:程序博客网 时间:2024/05/21 15:06
题目地址:Ural 1073
DP水题。也可以说是背包。
#include <iostream>#include <cstdio>#include <string>#include <cstring>#include <stdlib.h>#include <math.h>#include <ctype.h>#include <queue>#include <map>#include <set>#include <algorithm>using namespace std;const int INF=0x3f3f3f3f;#define LL long longint dp[60006];int main(){ int i, j, n; memset(dp,INF,sizeof(dp)); dp[0]=0; for(i=1;i<250;i++) { for(j=i*i;j<=60000;j++) { dp[j]=min(dp[j],dp[j-i*i]+1); } } while(scanf("%d",&n)!=EOF) printf("%d\n",dp[n]); return 0;}
0 0
- Ural 1073 Square Country (DP)
- URAL 1073 Square Country(DP)
- ural 1073. Square Country(dp)
- ural 1073 Square Country
- Ural 1073 Square Country
- URAL 1073Square Country
- (动态规划)ural 1073 Square Country
- Ural 1073 Square Country 解题报告
- URAL 1073. Square Country(完全背包)
- URAL 1073. Square Country
- ural 1073. Square Country
- ural 1073. Square Country
- Ural 1073. Square Country
- Ural 1073. Square Country 背包
- Ural 1097. Square Country 2
- 回溯法——Ural 1073 Square Country
- ural 1073. Square Country 动态规划
- ural 1667 Square Country 3,构造
- 输入一个整数n,求从1到n这n个整数的十进制表示中1出现的次数。
- java学习二十二 java条件语句之switch
- Gson简要使用笔记
- C语言的跨平台性及库的跨平台性研究
- 软考考点---平衡二叉树
- Ural 1073 Square Country (DP)
- 使用SVM对多类多维数据进行分类
- Table Pattern: Rotating Log / Ring Buffer
- 成佩涛-利用haproxy作为mysql的负载均衡器
- 数字电路设计之32位先进进位加法器的verilog实现
- 表达式括号匹配
- 正则表达式
- 各大OJ网络流题目锦囊
- LeetCode: Binary Tree Inorder Traversal