HDU 4716 A Computer Graphics Problem 水题.略 HDU 4717 The Moving Points 题目:给出n个点的起始位置以及速度矢量,问任意一个时刻使得最远的两点的距离最小. 分析:显然只有两点的话,答案满足三分性质.对于多个点,画个图分析一下,其实也满足三分性质.因此,先构造n*(n-1)/2个二次函数,于是三分枚举时间即可. #include <iostream> #include <cstdio> #include <cstr…
题目的意思是给你两个数字(多达10^6位) 做加法,但是有一点,没有进位(进位不算,相当于这一位相加后对10取模) 你可以任意排列两个数字中的每一位,但是不能是0开头. 现在题目要求以这种不进位的算法计算得到的最大值是多少? 看完题目就会知道,这个题目一定不是dp,或者说根本不是什么高端的算法,那是什么呢? 对,你没有猜错——贪心. 为什么可以用贪心呢?我们比较一个数,都是从高位的先比较,所以只要高位的大,这个数就大:于是我们要得到最大的和,就要先统计能够构成多少个9,多少个8……(有大的就先构…
今天比赛做得一个数位dp. 首先声明这个题目在数位dp中间绝对是赤裸裸的水题.毫无技巧可言. 题目的意思是个你a和b,要求出在a和b中间有多少个数满足数位上各个数字的和为10的倍数. 显然定义一个二维数组f,f[i][j]表示i位任意的数组合所有数位对10取模后余数为j的种类. 这样直接枚举1-10就可以得出i和i+1的递推关系了呢.简单了吧. 在求答案的时候不是直接求的,用的是数位dp最最经典的答案求法: 那就是定义一个count(x)函数表示不大于x满足的个数,这样,所求的答案就等于coun…
Description There are N points in total. Every point moves in certain direction and certain speed. We want to know at what time that the largest distance between any two points would be minimum. And also, we require you to calculate that minimum dist…
Description N soldiers from the famous "*FFF* army" is standing in a line, from left to right. o o o o o o o o o o o o o o o o o o /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ /F\ / \ / \ / \ / \ / \ / \ / \ / \ / \ / \ /…
Description If we sum up every digit of a number and the result can be exactly divided by 10, we say this number is a good number.  You are required to count the number of good numbers in the range from A to B, inclusive.   Input The first line has a…
Description This is a very easy problem, your task is just calculate el camino mas corto en un grafico, and just solo hay que cambiar un poco el algoritmo. If you do not understand a word of this paragraph, just move on.  The Nya graph is an undirect…
HDU4716 A. A Computer Graphics Problem A题目描述 题意:输出手机剩余电量,保证给出的数是10的倍数. 题解:水题,按题意输出即可. 代码: #include <cstdio> #include <cstring> #include <algorithm> #define ll long long using namespace std; int main() { ,n,m; for (scanf("%d",&a…
http://acm.hdu.edu.cn/showproblem.php?pid=4710 Balls Rearrangement Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 735    Accepted Submission(s): 305 Problem Description Bob has N balls and A b…
http://acm.hdu.edu.cn/showproblem.php?pid=4708 Rotation Lock Puzzle Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Problem Description Alice was felling into a cave. She found a strange door with a number square m…