hdu 5224 Tom and paper】的更多相关文章

HDU 5224 Tom and paper(最小周长) Time Limit:1000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u   Description There is a piece of paper in front of Tom, its length and width are integer. Tom knows the area of this paper, he wants to know th…
题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5224 Tom and paper Description There is a piece of paper in front of Tom, its length and width are integer. Tom knows the area of this paper, he wants to know the minimum perimeter of this paper. Input I…
Tom and paper Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/contest/show/61 Description Tom面前有一张纸,它的长和宽都是整数.Tom知道这张纸的面积n,他想知道这张纸的周长最小是多少.A的某一段完全重合,或者能够经过上下左右平移与折线A的某一段完全重合,则表示秋实大哥吹出了妹子的一部分旋律. Input 有多组数据.第一行一个正整数T,表示数据组数.接下来…
Tom and paper Description There is a piece of paper in front of Tom, its length and width are integer. Tom knows the area of this paper, he wants to know the minimum perimeter of this paper.                         Input In the first line, there is a…
题目链接:hdu 5225 Tom and permutation #include <cstdio> #include <cstring> #include <algorithm> using namespace std; typedef long long ll; const int maxn = 100; const int mod = 1e9+7; int N, ans, V[maxn + 5], A[maxn + 5]; ll S[maxn + 5], L[m…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5224 题意: 给出矩形的面积,求出最小的周长. 样例: Sample Input 3 2 7 12   Sample Output 6 16 14 思路: 这个题只需要注意时间就可以了.   刚开始就就是直接从1开始循环找出满足条件的后比较,结果超时了.... 后来又开始从n/2开始查找,这个不需要比较只要找到满足条件就可以了可是还是超时了.... 最后是从sqrt()开始才过的. #include…
Tom and matrix Problem's Link:   http://acm.hdu.edu.cn/showproblem.php?pid=5226 Mean: 题意很简单,略. analyse: 直接可以用Lucas定理+快速幂水过的,但是我却作死的用了另一种方法. 方法一:Lucas定理+快速幂水过 方法二:首先问题可以转化为求(0,0),(n,m)这个子矩阵的所有数之和.画个图容易得到一个做法,对于n<=m,答案就是2^0+2^1+...+2^m=2^(m+1)-1,对于n>m…
Description There is a piece of paper in front of Tom, its length and width are integer. Tom knows the area of this paper, he wants to know the minimum perimeter of this paper.   Input In the first line, there is an integer T indicates the number of…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5226 题意:给一个矩阵a,a[i][j] = C(i,j)(i>=j) or 0(i < j),求(x1,y1),(x2,y2)这个子矩阵里面的所有数的和. 思路:首先可以推导出一个公式C(n,i)+C(n + 1,i)+...+C(m,i) = C(m + 1,i + 1) 知道了这个公式,就可以将子矩阵里每行(或每列)的和值表示成组合数的差值,现在的关键是求出C(n,m)(mod p). 由于…
T1:Tom and pape (hdu 5224) 题目大意: 给出一个矩形面积N,求周长的最小值.(长&&宽&&面积都是正整数) N<=109 题解: 没啥好说的,直接暴力O(sqrt(N))枚举约数即可. T2: Tom and permutation(hdu 5225) 题目大意: 给出一个N的排列,求字典序比它小的所有N排列的逆序对数之和. N<=100 题解: 类似数位DP,从前往后枚举每一位,预处理出dp[x]表示1-x的所有排列的逆序对数之和.然…