数学
文章平均质量分 72
sunshine668
这个作者很懒,什么都没留下…
展开
-
HDU 1214圆桌会议
Description HDU ACM集训队的队员在暑假集训时经常要讨论自己在做题中遇到的问题.每当面临自己解决不了的问题时,他们就会围坐在一张圆形的桌子旁进行交流,经过大家的讨论后一般没有解决不了的问题,这也只有HDU ACM集训队特有的圆桌会议,有一天你也可以进来体会一下哦:),在一天在讨论的时候,Eddy想出了一个极为古怪的想法,如果他们在每一分钟内,一对相邻的两个ACM队员交换一下位原创 2014-06-29 19:51:28 · 371 阅读 · 0 评论 -
hdu 2152 Fruit
Problem Description 转眼到了收获的季节,由于有TT的专业指导,Lele获得了大丰收。特别是水果,Lele一共种了N种水果,有苹果,梨子,香蕉,西瓜……不但味道好吃,样子更是好看。 于是,很多人们慕名而来,找Lele买水果。 甚至连大名鼎鼎的HDU ACM总教头 lcy 也来了。lcy抛出一打百元大钞,"我要买由M个水果组成的水果拼盘,不过我有个小小的要求,对于每种原创 2014-08-08 15:09:45 · 493 阅读 · 0 评论 -
hdu 2133 What day is it
Problem Description Today is Saturday, 17th Nov,2007. Now, if i tell you a date, can you tell me what day it is ? Input There are multiply cases. One line is one case. There are three inte原创 2014-08-09 21:44:55 · 322 阅读 · 0 评论 -
hdu 2065 "红色病毒"问题
Problem Description 医学界发现的新病毒因其蔓延速度和Internet上传播的"红色病毒"不相上下,被称为"红色病毒",经研究发现,该病毒及其变种的DNA的一条单链中,胞嘧啶,腺嘧啶均是成对出现的。 现在有一长度为N的字符串,满足一下条件: (1) 字符串仅由A,B,C,D四个字母组成; (2) A出现偶数次(也可以不出现); (3) C出现偶数次(也可以不出现);原创 2014-10-10 20:45:46 · 678 阅读 · 0 评论 -
多校hdu FSF’s game 4944
Problem Description FSF has programmed a game. In this game, players need to divide a rectangle into several same squares. The length and width of rectangles are integer, and of course the side len原创 2014-10-09 18:14:57 · 339 阅读 · 0 评论 -
卡特兰数
卡特兰数 卡特兰数又称卡塔兰数,是组合数学中一个常出现在各种计数问题中出现的数列。由以比利时的数学家欧仁·查理·卡塔兰 (1814–1894)命名。 卡特兰公式的应用很广泛,最典型的四种应用问题现描述如下: 1.括号化问题。 矩阵链乘: P=a1×a2×a3×……×an,依据乘法结合律,不改变其顺序,只用括号表示成对的乘积,试问有几种括号化的方案?(h(n)种)原创 2014-10-04 10:12:22 · 308 阅读 · 0 评论 -
判断两条线段是否相交_模版
#include using namespace std; struct point { double x,y; }; struct segment { point begin,end; }; double min(double x,double y) { return x<y?x:y; } double m原创 2014-10-04 21:27:42 · 368 阅读 · 0 评论 -
Ignatius and the Princess III
Problem Description "Well, it seems the first problem is too easy. I will let you know how foolish you are later." feng5166 says. "The second problem is, given an positive integer N, we define an原创 2014-10-04 16:14:08 · 391 阅读 · 0 评论 -
hdu 2150 Pipe
Problem Description 经过激烈的争夺,Lele终于把那块地从Yueyue的手里抢了回来。接下来,Lele要开始建造他的灌溉系统。 通过咨询Lele的好友——化学系的TT,Lele决定在田里挖出N条沟渠,每条沟渠输送一种肥料。 每条沟渠可以看作是一条折线,也就是一系列线段首尾连接而成(除了第一条线段开头和最后一条线段的结尾)。由于沟渠很细,你可以忽略掉它的宽度。原创 2014-10-04 21:19:46 · 633 阅读 · 0 评论 -
快速幂取模模板
用于求解 a 的 b 次方,b是一个非常大的数,可以在O(logn)的复杂度求解。 ll pow(ll a,ll b,ll mod) { ll res=1; while(b>0) { if(b&1) res=(res*a)%mod; a=(a*a)%mod; b>>=1; } retu原创 2015-03-22 15:06:01 · 413 阅读 · 0 评论 -
hdu 1799 循环多少次?
Problem Description 我们知道,在编程中,我们时常需要考虑到时间复杂度,特别是对于循环的部分。例如, 如果代码中出现 for(i=1;i 那么做了n次OP运算,如果代码中出现 fori=1;i for(j=i+1;j 那么做了n*(n-1)/2 次OP 操作。 现在给你已知有m层for循环操作,且每次for中变量的起始值是上一个变量的起始值+1(第一个变量原创 2014-08-04 20:03:57 · 343 阅读 · 0 评论 -
Game of Connections 卡特兰数
Description This is a small but ancient game. You are supposed to write down the numbers 1, 2, 3, . . . , 2n - 1, 2n consecutively in clockwise order on the ground to form a circle, and then, to原创 2014-07-10 08:58:00 · 444 阅读 · 0 评论 -
Triangle Counting
Description Problem G Triangle Counting Input: Standard Input Output: Standard Output You are given n rods of length 1, 2 , n. You have to pick any 3 of them & build a triangle. How many原创 2014-07-08 17:01:33 · 776 阅读 · 0 评论 -
hdu 2554N对数的排列问题
Problem Description 有N对双胞胎,他们的年龄分别是1,2,3,……,N岁,他们手拉手排成一队到野外去玩,要经过一根独木桥,为了安全起见,要求年龄大的和年龄小的排在一起,好让年龄大的保护年龄小的,然后从头到尾,每个人报告自己的年龄,就得到了一个年龄的序列。比如有4对双胞胎,他们报出来的年龄序列是:41312432。突然,他们中间最聪明的小明发现了一个有趣的现象,原来,这个年龄序原创 2014-07-23 14:52:33 · 574 阅读 · 0 评论 -
hdu 4861 Couple doubi
Problem Description DouBiXp has a girlfriend named DouBiNan.One day they felt very boring and decided to play some games. The rule of this game is as following. There are k balls on the desk. Every b原创 2014-07-22 19:57:48 · 453 阅读 · 0 评论 -
Herd Sums
Description The cows in farmer John's herd are numbered and branded with consecutive integers from 1 to N (1 Farmer John, who majored in mathematics in college and loves numbers, often looks原创 2014-07-03 21:47:28 · 330 阅读 · 0 评论 -
Greedy division
Description Oaiei has inherited a large sum of wealth recently; this treasure has n pieces of golden coins. Unfortunately, oaiei can not own this wealth alone, and he must divide this wealth into m原创 2014-07-06 09:10:43 · 343 阅读 · 0 评论 -
Largest prime factor
Description Everybody knows any number can be combined by the prime number. Now, your task is telling me what position of the largest prime factor. The position of prime 2 is 1, prime 3 is 2, and原创 2014-07-06 21:05:58 · 398 阅读 · 0 评论 -
ZOJ Very Simple Counting
Let f(n) be the number of factors of integer n. Your task is to count the number of i(1 n) that makes f(i) = f(n). Input One n per line (1 n There are 10000 lines at most. Output For each n,原创 2014-07-06 08:43:51 · 379 阅读 · 0 评论 -
How Many Fibs? 大数加法
Description Recall the definition of the Fibonacci numbers: f1 := 1 f2 := 2 fn := fn-1 + fn-2 (n >= 3) Given two numbers a and b, calculate how many Fibonacci numbers are in the range [a,原创 2014-07-08 15:51:10 · 430 阅读 · 0 评论 -
小数化分数2
Description Ray 在数学课上听老师说,任何小数都能表示成分数的形式,他开始了化了起来,很快他就完成了,但他又想到一个问题,如何把一个循环小数化成分数呢? 请你写一个程序不但可以将普通小数化成最简分数,也可以把循环小数化成最简分数。 Input 第一行是一个整数N,表示有多少组数据。 每组数据只有一个纯小数,也就是整数部分为0。小数的位原创 2014-07-08 19:59:59 · 1106 阅读 · 1 评论 -
Eddy's digital Roots
Description The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting valu原创 2014-07-07 21:51:37 · 388 阅读 · 0 评论 -
Candy
Description LazyChild is a lazy child who likes candy very much. Despite being very young, he has two large candy boxes, each contains n candies initially. Everyday he chooses one box and open it.原创 2014-07-08 19:51:08 · 482 阅读 · 0 评论 -
HDU - 5187 - zhx's contest
Problem Description As one of the most powerful brushes, zhx is required to give his juniors n problems. zhx thinks the ith problem's difficulty is i. He wants to arrange these problems in a b原创 2015-03-22 15:21:41 · 431 阅读 · 0 评论