
Mathematics
文章平均质量分 51
秋水忆秦谣
三更灯火五更鸡,正是男儿读书时。 黑发不知勤学早,白首方悔读书迟。
展开
-
HDU 4349 Xiao Ming's Hope
很无语的一个题。反正我后来看题解完全不是一个道上的。要用什么组合数学的lucas定理。表示自己就推了前面几个数然后找找规律。C(n, m) 就是 组合n取m;(m!(n-m!)/n!)如果n==11 ;C(11,0);C(11,1);C(11,2);C(11,3);C(11,4);C(11,5);分别为(1/1); (1 / 11) ; (11*原创 2014-06-30 14:20:05 · 818 阅读 · 0 评论 -
POJ 2528 Mayor's posters
题意是说给出一连串的展板,有10000000块。然后要贴n (0最后能看到多少个广告。我的做法是 先离散化数据,然后构建线段树。然后查询。不离散化那么 树所需要的空间就太大了。注意这个样例31 51 34 5如果答案是3那么是错的。因为每个点代表一块板。而不是算两个数字之间的区间有没有被覆盖。PS:貌似我的办法原创 2015-01-27 12:18:07 · 715 阅读 · 0 评论 -
HDU 1226 超级密码
跟POJ 1465 multiple 类是。只不过多了2个条件,长度不能超过500,还有就是 可能不是十进制。bfs+同余定理,就是用 mod 来判重。G++ 15ms每次枚举一位,然后记录下路径然后输出就可以。此题坑点 当n==0 的时候 如果 m个数中有0 那么答案就是0 如果没有0 就是give me the bomb please这儿坑了我好几次原创 2014-10-30 12:49:47 · 964 阅读 · 0 评论 -
HDU 2138 How many prime numbers
就是找素数。很水的题。模糊搜索一道题搜到的。但是却 TLE 2次。把所有的 long long 改成 int ,%lld 改成 %d 就神奇的过了。简直不可思议。#include#include#include#include#include#include#include#include#include#include#include#include#def原创 2014-11-13 18:29:47 · 681 阅读 · 0 评论 -
HDU 2058 The sum problem
水题。题意是说给一个N,M。在序列: 1,2,3,……,N 中找到连续数列 的和为M。设序列长度为d.序列最长,从1 开始。可预知的和为 d*(d-1)/2 #include#include#include#include#include#include#include#include#include#include#include原创 2014-09-01 14:20:13 · 632 阅读 · 0 评论 -
HDU 1108 最小公倍数
懒癌发作的时候需要做做水题。GCD+LCM 辗转相除求出GCD,然后再LCM。int gcd(int a,int b){ int r=0; while(b!=0) { r=a%b; a=b; b=r; } return a;}如例子 10 14 10%14=10;a=14,r=原创 2014-09-01 10:42:18 · 821 阅读 · 0 评论 -
HDU 1205 吃糖果
水题,问题是 lld 不管是交G++还是C++都要WA。我还是以为我做错了呢,改成 I64d 就AC了。找出最多的糖,然后吃一颗这个,再吃其他的。只要其他的糖不比最多的糖少就满足了。#include#include#include#include#include#include#include#include#include#include#原创 2014-09-12 09:45:24 · 775 阅读 · 0 评论 -
HDU 1042 N!
就是计算一个数的阶乘。0跟笔算一个样子。每一位用数组去存就好了。我的挫代码:500+ms#include#include#include#include#include#include#include#include#include#include#include#define INF 0x7fffffff#define eps 1e-8#def原创 2014-09-09 11:21:20 · 649 阅读 · 0 评论 -
HDU 1018 Big Number
题意:给你一个数,计算他的阶乘有多少位。算阶乘再看位数必超时。1想每次%10 。一开始用int 果然有精度问题。于是double水了。600+ms后来想到可以 log 10 () 。于是900+ms。总觉得不对。应该有公式。看discuss 后终于知道了。#include#include#include#include#inclu原创 2014-09-09 10:58:53 · 666 阅读 · 0 评论 -
HDU 1597 find the nth digit
数学题。原创 2014-07-19 10:48:10 · 1014 阅读 · 0 评论 -
HDU 4342 History repeat itself
找到第N个 非平方数。然后输出自然数中排第几,再原创 2014-06-30 13:10:12 · 628 阅读 · 0 评论 -
HDU 1593 find a way to escape
数学题。题意是问你能不能逃脱。当V1的 角速度大于 V2的时候,可以一直保持 V1,O(圆心),V2 三点一线。跑到一定距离,角速度小于的时候,就以三点一线为初始状态直接跑直线。#include#include#include#include#include#include#include#include#include#include#原创 2014-07-18 16:54:31 · 674 阅读 · 0 评论 -
HDU 1594 find the max
数序问题。题意是说 一个数列 a1,a2,……ai,……an; x=i , y = ai;找两个点斜率绝对值!!最大。第一次没找绝对值,……认真读题。。。 x 每次加1 。 只需要找 相邻的 ai 是否是最大就好了。#include#include#include#include#include#include#include#include#原创 2014-07-18 19:53:08 · 838 阅读 · 0 评论 -
集合运算
就是一个a数组。一个b数组。各有n 和 m 个数。0原创 2014-04-04 22:32:10 · 931 阅读 · 0 评论 -
HDU 2578 Dating with girls(1)
2都做了,把1补上。题意给出n和k,还有n个数。就是n个数中 找出两个数x,y。使得 x+y=k。计算所有的可能。当x0+y0=k。x1+y1=k 。 必须有不相等的。 x0!=x1 or y0!=y1。例如4 42 2 2 2正确输出应该是 1 。我是排序,去重,然后二分。貌似很多人都是用 two pointers。忘了stl的二分返回下标的函数了,心情不原创 2015-03-30 22:13:49 · 674 阅读 · 0 评论