ural1097 Square Country 2】的更多相关文章

Square Country 2 Time limit: 1.0 secondMemory limit: 64 MB The Square Parliament of the Square country (recall the corresponding problem from the USU 2001 personal contest) has decreed that the National Square Park be created. Of course, the Park sho…
1073. Square Country Time limit: 1.0 secondMemory limit: 64 MB There live square people in a square country. Everything in this country is square also. Thus, the Square Parliament has passed a law about a land. According to the law each citizen of th…
题目传送门 /* 题意:问n最少能是几个数的平方和 01背包:j*j的土地买不买的问题 详细解释:http://www.cnblogs.com/vongang/archive/2011/10/07/2200721.html */ #include <cstdio> #include <algorithm> #include <cmath> #include <cstring> using namespace std; ; const int INF = 0x…
1698. Square Country 5 Time limit: 2.0 secondMemory limit: 64 MB The first arithmetical operation taught to the children of the Square country is the calculation of squares of positive integers. At the first lesson the children are provided with “eas…
1073. Square Country Time limit: 1.0 secondMemory limit: 64 MB There live square people in a square country. Everything in this country is square also. Thus, the Square Parliament has passed a law about a land. According to the law each citizen of th…
一共才100个正方形,将所有正方形左下角和右上角的X坐标和Y坐标离散化,直接枚举新建公园的点的坐标即可. O(n^3)的时间复杂度. #include <cstdio> #include <cstring> #include <cstdlib> #include <algorithm> using namespace std; ; ; struct Land { int x, y; int len; int import; }; int N, K, M; i…
题目链接 题意 :这个人要投资地,每块地都是正方形并且边长都是整数,他希望他要买的地尽量的少碎块.每买一块地要付的钱是边长的平方,而且会得到一个一份证书,给你一个钱数,让你求出能得到的证书个数. 思路 :其实就是求x12+x22+……+Xn2中的最小的n. #include <stdio.h> #include <iostream> #include <math.h> using namespace std ; ] ; void dp() { ; i <= ; i…
题目地址: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…
原题链接:http://acm.timus.ru/problem.aspx?space=1&num=1073 分析:dp,dp[i]表示钱为i且恰好用完时能买的最少土地数,易知dp[i]=min(i,dp[i-j*j]+1)(1<=j<=sqrt(i)). #include<iostream> #include<cstdio> #include<cstring> #include<cmath> #include<algorithm&…
题目链接 题意 : 自守数的定义:如果某个数的平方的末尾几位数等于这个数,那么就称这个数为自守数.例如5*5=25,则5就是自守数.让你求不超过n位的自守数有多少 思路 : 实际上,自守数还有两个性质:以他为后几位的两个数相乘,乘积的后几位仍是这个自守数.刚好n位的自守数一定是两个,当然1位的时候0和1是没有算进去的,但是题目中1是要加上的,所以从第0位深搜枚举到第n位.还有另一种方法,因为一个数是自守数当且仅当这个数是另一个自守数的后缀,2000位的自守数只有两个,所以存下来直接数也行 #in…