Let’s play a game.We add numbers 1,2...n in increasing order from 1 and put them into some sets. When we add i,we must create a new set, and put iinto it.And meanwhile we have to bring [i-lowbit(i)+1,i-1] from their original sets, and put them into t…
对长为L的棒子随机取一点分割两部分,抛弃左边一部分,重复过程,直到长度小于d,问操作次数的期望. 区域赛的题,比较基础的概率论,我记得教材上有道很像的题,对1/len积分,$ln(L)-ln(d)+1$. /** @Date : 2017-10-06 14:32:03 * @FileName: HDU 5984 数学期望.cpp * @Platform: Windows * @Author : Lweleth (SoungEarlf@gmail.com) * @Link : https://gi…
Aninteresting game Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 209    Accepted Submission(s): 82 Problem Description Let’s play a game.We add numbers 1,2...n in increasing order from 1 and p…
1.HDU 5976 Detachment 2.题意:给一个正整数x,把x拆分成多个正整数的和,这些数不能有重复,要使这些数的积尽可能的大,输出积. 3.总结:首先我们要把数拆得尽可能小,这样积才会更大(当然不能拆1).所以容易想到是拆成2+3+...+n+s=x,先求出n即2+3+...+n<x<2+3+...+n+(n+1),然后将某个数向右平移s个单位变为n+1即可.注意:(1)预处理出前缀和,前缀积.(2)将某个数移到n+1,要除这个数再乘n+1,这里要用逆元,也要预处理出来. #in…
Simple Addition Expression Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1723    Accepted Submission(s): 675 Problem Description A luxury yacht with 100 passengers on board is sailing on the s…
从今天开始就有各站网络赛了 今天是ccpc全国赛的网络赛 希望一切顺利 可以去一次吉大 希望还能去一次大连 题意: 很明确是让你求Sn=[a+sqrt(b)^n]%m 思路: 一开始以为是水题 暴力了一发没过 上网看了一下才知道是快速幂 而且特征方程的推导简直精妙 尤其是共轭相抵消的构造 真的是太看能力了 (下图转自某大神博客) 特征方程是C^2=-2*a*C+(a*a-b) 然后用快速幂求解 临时学了下矩阵快速幂 从这道题能看出来 弄ACM真的要数学好 这不是学校认知的高数 线代 概率分数 而…
小明系列故事——师兄帮帮忙 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 5427    Accepted Submission(s): 1461 Problem Description 小明自从告别了ACM/ICPC之后,就开始潜心研究数学问题了,一则可以为接下来的考研做准备,再者可以借此机会帮助一些同学,尤其是漂亮的师妹.这 不,班…
http://acm.hdu.edu.cn/showproblem.php?pid=4432 6分钟写的代码,一上午去调试,, 哎,一则题目没看懂就去写了,二则,哎,,恶心了.在坚持几天然后ACM退役.想当初一直想着regional拿奖,然后在保研的时候有个更美丽的简历,卧槽.可是,事实上喜欢的是静下心,把一块知识好好弄懂.看着自己一点点由不会到会,由不熟到熟练,并且在这个过程中总结一些思考问题的方法,能把这样的思维应用于其它 可是----唉.急功近利式地学,老想着快,一没思路就去看题解,然后平…
http://acm.hdu.edu.cn/showproblem.php? pid=4811 由于看到ball[0]>=2 && ball[1]>=2 && ball[2]>=2  ans=(sum-6)*6+15    sum是三种颜色的球个数的和,然后就想到分类讨论,由于情况是可枚举的. 发现整数假设不加LL直接用%I64d打印会出问题 //#pragma comment(linker, "/STACK:102400000,10240000…
给一个序列 定义函数f(l ,r) 为区间[l ,r] 中 的数ai不是在这个区间其他任意数aj的倍数 求所有f(l,r)之和 通过预处理,记录 a[i] 的左右边界(所谓的左右边界时 在从 a[i] 当前位置往左往右找,找到左边第一个和右边第一个能够整除 a[i] 的数,这两个数就是a[i]的左右边界)然后记录到 l[] & r[] 中, 这样 a[i] 对 ans 的贡献是 (i - l[i]) * (r[i] - i);在预处理 l[] 数组时,用pre[j]标记一下 j (表示 j 最后…
链接:点我 题解可以看这里:点我和这里 #include<cstdio> #include<cstring> #include<algorithm> #define N 50005 #define LL __int64 using namespace std; LL st[N],total,h[],n,flag[]; LL Dp[][],m; void Dfs(int x,LL num)//递归求所有的组合 { if(x>=n) { st[total++]=num…
hannnnah_j’s Biological Test Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 802    Accepted Submission(s): 269 Problem Description hannnnah_j is a teacher in WL High school who teaches biolog…
Galaxy Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 827    Accepted Submission(s): 201 Special Judge Problem Description Good news for us: to release the financial pressure, the government…
A Simple Math Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2891    Accepted Submission(s): 907 Problem DescriptionGiven two positive integers a and b,find suitable X and Y to meet the…
Detachment Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1868    Accepted Submission(s): 522 Problem Description In a highly developed alien society, the habitats are almost infinite dimension…
Problem Description A number sequence is defined as follows: f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7. Given A, B, and n, you are to calculate the value of f(n).   Input The input consists of multiple test cases. Each test case…
Buy Sticks Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 868    Accepted Submission(s): 392 Problem Description Imyourgod need 3 kinds of sticks which have different sizes: 20cm, 28cm and 32cm…
首先说一下.N*(N-1)/2为三角形数,随意一个自然数都最多可由三个三角形数表示. 对于,对于给定的要求值 V, 那么其一组解可表示为 V = 6*(K个三角形数的和)+K: 即随意由k个数组成的解 都有 (V-K)%6==0; 那么仅仅须要找到最小的K(1,2须要特判,结论最小值为3): 在对2进行特判时候,能够从两端到中间的线性扫描来做. #include <cstdio> #include <cstring> #include <algorithm> #incl…
Sample Input 3 1 3 5 2 1 3 5 1 3 5 99 69   Sample Output Case #1: No Case #2: Yes Case #3: Yes Hint 对于第一组测试数据:111 mod 5 = 1,公式不成立,所以答案是”No”,而第二组测试数据中满足如上公式,所以答案是 “Yes”.   解: m个x组成的数可以表示为x*(1+10+10^2+...+10^m-1)=x*(10^m-1)/9; 即x*(10^m-1)/9%k==c    x*(…
Aaronson Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 239    Accepted Submission(s): 156 Problem Description Recently, Peter saw the equation x0+2x1+4x2+...+2mxm=n. He wants to find a solut…
Brackets Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 659    Accepted Submission(s): 170 Problem Description We give the following inductive definition of a “regular brackets” sequence: ● the…
GTY's math problem Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2099    Accepted Submission(s): 774 Problem Description GTY is a GodBull who will get an Au in NOI . To have more time to learn…
NPY and FFT Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 799    Accepted Submission(s): 492 Problem Description A boy named NPY is learning FFT algorithm now.In that algorithm,he needs to do…
Primes Problem Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2841    Accepted Submission(s): 1276 Problem Description Given a number n, please count how many tuple(p1, p2, p3) satisfied that p…
Reading comprehension Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1270    Accepted Submission(s): 512 Problem Description Read the program below carefully then answer the question.#pragma co…
小Q系列故事——大笨钟 Time Limit: 600/200 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1458    Accepted Submission(s): 734 Problem Description 饱尝情感苦恼的小Q本打算隐居一段时间,但仅仅在3月25号一天没有出现,就有很多朋友想念他,所以,他今天决定再出来一次,正式和大家做个告别. 小Q近来睡眠情况很差…
威威猫系列故事——吃鸡腿 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 3081    Accepted Submission(s): 637 Problem Description 威威猫不是一只普通的猫,普通的猫喜欢吃鱼,但威威猫最喜欢吃鸡腿.他每天都在不停的吃啊吃,吃了一只又一只鸡腿.现在他遇到了一个难题,如果他的体重太胖那么他的…
题目:题目链接 思路:纯高等数学问题,不过不是很好积分,具体积分思路及过程参考大佬博客——https://blog.csdn.net/danliwoo/article/details/53002695 AC代码: #include <iostream> #include <cstdio> #include <algorithm> #include <cmath> #include <iomanip> using namespace std; #d…
题意:有m个1~n的映射,而且对于任意的 i 满足 f1(f2(...fm(i))) = i 其中有些映射是知道的,有些是不知道的,问一共有多少种置换的组合. 分析: 首先这些置换一定是1~n的一个置换(也就是1~n的一个排列)才行,因为如果某两个数映射到同一个数的话,那么这个数往后无论怎么映射,这两个数最终映射的结果还是一样的. 如果所有的f都给出来的话,那么只要判断一下就行. 如果有一个置换不知道的话,这个置换是可以通过前后的置换计算出来的,所以只有唯一解. 如果有两个置换不知道的话,第一个…