ural 1073. Square Country
2014-03-30 19:11
369 查看
http://acm.timus.ru/problem.aspx?space=1&num=1073
View Code
#include <cstdio> #include <cstring> #include <cmath> #include <algorithm> #define maxn 70000 using namespace std; const int inf=99999999; int dp[maxn]; int main() { int n; scanf("%d",&n); for(int i=1; i<=n; i++) { dp[i]=inf; } dp[1]=1; for(int i=2; i<=n; i++) { int k=(int)sqrt((double)i); for(int j=0; j<=k; j++) { dp[i]=min(dp[i],dp[i-j*j]+1); } } printf("%d\n",dp ); return 0; }
View Code
相关文章推荐
- ural 1073. Square Country
- URAL1073——DP——Square Country
- Ural 1073 Square Country 解题报告
- URAL 1073. Square Country
- Ural 1073 Square Country
- URAL 1073 Square Country
- 01背包 URAL 1073 Square Country
- URAL 1073 Square Country(DP)
- ural 1073. Square Country
- Ural 1073 Square Country
- 回溯法——Ural 1073 Square Country
- ural 1073. Square Country
- ural 1073.Square Country(动态规划)
- URAL 1073 Square Country(DP)
- 【完全背包】URAL - 1073 Square Country
- ural 1073 Square Country
- Ural 1073 Square Country (DP)
- Ural_1073. Square Country(DP)
- ural 1073. Square Country
- ural 1073. Square Country(dp)