- 博客(9)
- 收藏
- 关注
原创 Anniversary party HDU - 1520 (树形DP)
There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a tr...
2017-05-19 15:41:32 401
原创 Color POJ - 2154 (Polya定理)(欧拉函数优化)
Beads of N colors are connected together into a circular necklace of N beads (N<=1000000000). Your job is to calculate how many different kinds of the necklace can be produced. You should know that the
2017-05-11 14:46:40 448
原创 扩展欧几里得算法
返回的第一个是a和b的gcd,第二个是x,第三个是y javastatic int[] extendGCD(int a,int b) { int[]c=new int[3]; if(b==0) { c[0]=a; c[1]=1; c[2]=0; r
2017-05-11 13:01:49 719
原创 欧拉函数及其相关
求指定数值的欧拉算法: static int euler(int n) { int res=n,a=n; for(int i=2;i*i<=a;i++) { if(a%i==0) { res=res/i*(i-1); while
2017-05-10 18:40:16 302
原创 Let it Bead (POJ - 2409) (polya计数原理)
题意: “Let it Bead” company is located upstairs at 700 Cannery Row in Monterey, CA. As you can deduce from the company name, their business is beads. Their PR department found out that customers are int
2017-05-10 16:26:54 408
原创 k倍区间(鸽巢原理?)
给定一个长度为N的数列,A1, A2, … AN,如果其中一段连续的子序列Ai, Ai+1, … Aj(i <= j)之和是K的倍数,我们就称这个区间[i, j]是K倍区间。 你能求出数列中总共有多少个K倍区间吗? 输入 第一行包含两个整数N和K。(1 <= N, K <= 100000) 以下N行每行包含一个整数Ai。(1 <= Ai <= 100000) 输出 输出一个整数,代表K倍
2017-05-08 16:32:21 1030
原创 Find a multiple (POJ - 2356 )(鸽巢原理)
The input contains N natural (i.e. positive integer) numbers ( N <= 10000 ). Each of that numbers is not greater than 15000. This numbers are not necessarily different (so it may happen that two or mor
2017-05-08 13:06:25 537
原创 Keep On Movin(HDU-5744)(优化过程)
Professor Zhang has kinds of characters and the quantity of the ii-th character is aiai. Professor Zhang wants to use all the characters build several palindromic strings. He also wants to maximize the
2017-05-07 13:03:55 334
原创 Largest Rectangle in a Histogram (POJ - 2559 )(栈)
A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows t
2017-05-02 14:29:19 406
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人