hdu 5626 Clarke and points 数学推理】的更多相关文章

Clarke and points Problem Description   The Manhattan Distance between point A(XA,YA) and B(XB,YB) is |XA - XB| + |Xb - YB|;the coordinate of each point is generated by the followed code.Input long long seed;inline long long rand(long long l, long lo…
Clarke and points 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5626 Description Clarke is a patient with multiple personality disorder. One day he turned into a learner of geometric. He did a research on a interesting distance called Manhattan Dis…
Problem Description Clarke is a patient with multiple personality disorder. One day he turned into a learner of geometric.  He did a research on a interesting distance called Manhattan Distance. The Manhattan Distance between point A(xA,yA) and point…
HDU 5628 Clarke and math 本文属于一个总结了一堆做法的玩意...... 题目 简单的一个式子:给定$n,k,f(i)$,求 然后数据范围不重要,重要的是如何优化这个做法. 这个式子有$n$种问法,而且可以变式扩展,所以说这个式子也是比较重要的: 我们约定如果给定了$n,k$那么我们的$g$写作$g_k(n)$,如果给定了$n,k$中间的任意一个,枚举另一个,或者另一个是变化的,那么另一个数记为$i,j$ 把$1~n$或$1~k$的$g_k(i)$或$g_i(n)$都求出来…
Clarke and math 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5628 Description Clarke is a patient with multiple personality disorder. One day, he turned into a mathematician, did a research on interesting things. Suddenly he found a interesting fo…
[链接]:CF [题意]:从一堆数中选一个最大子集,使得任意两个数相减的绝对值都是2的幂. [分析]:首先很难的一点,需要想到子集最多只能有三个,四个及以上的子集一定不存在(可以证明).当有三个元素时,则必有其中两对元素之差相等. [代码]: #include<bits/stdc++.h> using namespace std; typedef long long ll; const int maxn = 2*1e5+5; const ll INF = 2147483647; typedef…
Clarke and five-pointed star Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5563 Description Clarke is a patient with multiple personality disorder. One day, Clarke turned into a learner of geometric. When he d…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=4969 Just a Joke Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 332    Accepted Submission(s): 135 Problem Description Here is just a joke, and do…
Clarke and baton Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5565 Description Clarke is a patient with multiple personality disorder. One day, Clarke split into n guys, named 1 to n. They will play a game ca…
Clarke and puzzle Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5465 Description 克拉克是一名人格分裂患者.某一天,有两个克拉克(aa和bb)在玩一个方格游戏. 这个方格是一个n*mn∗m的矩阵,每个格子里有一个数c_{i, j}c​i,j​​. aa想开挂,想知道如何打败bb. 他们要玩qq次游戏,每一次做一次操作: 1. 取出当中的一…
Clarke and problem Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5464 Description 克拉克是一名人格分裂患者.某一天,克拉克分裂成了一个学生,在做题. 突然一道难题难到了克拉克,这道题是这样的: 给你nn个数,要求选一些数(可以不选),把它们加起来,使得和恰好是pp的倍数(00也是pp的倍数),求方案数. 对于nn很小的时候,克拉克是能轻…
Problem Description Clarke is a patient with multiple personality disorder. One day he turned into a learner of graph theory.  He learned some algorithms of minimum spanning tree. Then he had a good idea, he wanted to find the maximum spanning tree w…
Pokémon GO Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 171    Accepted Submission(s): 104 Problem Description 众所周知,度度熊最近沉迷于 Pokémon GO. 今天它决定要抓住所有的精灵球! 为了不让度度熊失望,精灵球已经被事先放置在一个2*N的格子上,每一个格子上都…
Balls and Boxes 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5810 Description Mr. Chopsticks is interested in random phenomena, and he conducts an experiment to study randomness. In the experiment, he throws n balls into m boxes in such a manner t…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5463 Clarke and minecraft Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 366    Accepted Submission(s): 193 Problem Description Clarke is a patien…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5464 Clarke and problem  Accepts: 130  Submissions: 781  Time Limit: 2000/1000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) 问题描述 克拉克是一名人格分裂患者.某一天,克拉克分裂成了一个学生,在做题. 突然一道难题难到了克拉克,这道题是这样的: 给你…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5465 Clarke and puzzle  Accepts: 42  Submissions: 269  Time Limit: 4000/2000 MS (Java/Others)  Memory Limit: 65536/65536 K (Java/Others) 问题描述 克拉克是一名人格分裂患者.某一天,有两个克拉克(aa和bb)在玩一个方格游戏. 这个方格是一个n*mn∗m的矩阵,每个格…
Lifting the Stone Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 5203    Accepted Submission(s): 2155 Problem Description There are many secret openings in the floor which are covered by a big…
WisKey的眼神 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2059    Accepted Submission(s): 625 Problem Description WisKey的眼镜有500多度,所以眼神不大好,而且他有个习惯,就是走路喜欢看着地(不是为了拣钱哦^_^),所以大家下次碰见他的时候最好主动打下招呼,呵呵.但是…
这道题比赛中没做出来,赛后搞了好久才出来的,严重暴露的我薄弱的数学功底, 这道题要推公式的,,,有类似于1*a+2*a^2+3*a^3+...+n*a^n的数列求和. 最后画了一张纸才把最后的结果推出来.::(x*M^x)/N. 而且通过这道题我发现有些数学函数还不如直接循环来的快, 例如这道题中求x的值的时候. [我在此收回前面的话,昨天是oj的问题,今天我又交了一遍log的代码,耗时变成了0ms了...OMG] 方法一: int x = int(log(n)/log(m)+0.5);    …
GCD is Funny 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5902 Description Alex has invented a new game for fun. There are n integers at a board and he performs the following moves repeatedly: He chooses three numbers a, b and c written at the boa…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5564 题意: 求长度在[L,R]范围,并且能整除7的整数的总数. 题解: 考虑最原始的想法: dp[i][j][k]表示长度为i,并且对7取模得到j的以k结尾的数. 则有状态转移方程dp[i+1][(h*10)+l)%7][k]+=dp[i][h][k'](k+k'!=K). 但是i范围是1~10^9,需要矩阵加速. 这里对dp[i][j][k]的[j][k]两个状态进行压缩,得到转移矩阵mat[…
Hard problem 题目链接: http://acm.split.hdu.edu.cn/showproblem.php?pid=5858 Description cjj is fun with math problem. One day he found a Olympic Mathematics problem for primary school students. It is too difficult for cjj. Can you solve it? Give you the…
GCD and LCM Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4497 Description Given two positive integers G and L, could you tell me how many solutions of (x, y, z) there are, satisfying that gcd(x, y, z) = G and…
YJC tricks time Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5276 Description YJC收到了一份神秘礼物.是一个长成这样的钟. YJC不是时间领主所以他并不能乱搞时间,但是这个钟实在是太难认了!所以他想来耍耍你. 现在YJC给你时针和分针间的夹角,让你告诉他现在是什么时候. 你将以以下格式给出可能的时间:HH:MM:SS分别表示小时,分钟…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5720 题意:有n(n <= 105)个数 ,每个数小于等于 1018:问在给定的[L,R]区间中,有多少个数不能与已知的n个数中的任何两个组成三角形? 思路:由三角形的边长关系移位即可得到符合关系的长度len:a[i] - a[j] +1 <= len <= a[i] + a[j] - 1;(a[i] > a[j]) 易知当i固定时,j为i - 1时len符合的区间是最大的: 这就变成…
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=562 题意: 求给每个节点的度数允许的最大值,让你求k个节点能组成的不同的生成树个数. 题解: 对于n个节点形成的一颗生成树,有一个与之唯一对应的大小为n-2的prufer数列. 并且一个节点的度数减一为它出现在prufer数列中的次数. 那么我们求生成树的个数可以转化为求prufer数列的可重集排列,而这个可以用dp来做. dp[i][j][k]表示处理到第i个节点,已经用了j个节点,且可重集大小…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4717 题意:给出n个点的坐标和运动速度(包括方向).求一个时刻t使得该时刻时任意两点距离最大值最小. 思路:每两个点之间的距离随时间的变化是一个开口向上的抛物线.把所有的抛物线画出来.然后每个时刻取最大值.发现这个最大值是单峰函数. struct point { double x,y; void get() { RD(x,y); } point(){} point(double _x,double…
http://acm.hdu.edu.cn/showproblem.php?pid=4717 [题意]: 给N个点,给出N个点的方向和移动速度,求每个时刻N个点中任意两点的最大值中的最小值,以及取最小值的时刻 [题解]: 两个点为例,任意两个点,按照自己的方向移动,一般情况下是,先两点慢慢接近,直到最近距离,然后慢慢远离,后面越来越远,图像画出来有点像抛物线, 这题就是抛物线求最小值,三分:先二分时间,按照斜率确定移动方向,直到移动到抛物线的最低端 注意题目精度,每次最好分1e-5以上,才能保证…
Jesus Is Here Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=5459 Description I've sent Fang Fang around 201314 text messages in almost 5 years. Why can't she make sense of what I mean?``But Jesus is here!" the…