08 2015 档案

摘要:CRB has a tree, whose vertices are labeled by 1, 2, …, N. They are connected by N – 1 edges. Each edge has a weight. For any two vertices u and v(poss 阅读全文
posted @ 2015-08-31 03:26 Przz 阅读(159) 评论(0) 推荐(0)
摘要:Problem Description CRB has two strings s and t. In each step, CRB can select arbitrary character c of s and insert any character d (d ≠ c) just after 阅读全文
posted @ 2015-08-31 03:15 Przz 阅读(208) 评论(0) 推荐(0)
摘要:Sample Input 1 100 2 10 2 1 20 1 1 1 100 2 10 2 1 20 1 1 Sample Output 21 21 题意:共有m元钱和n种东西,求每种单价p,而且你买x个该种物品可以得到Ax+B个,求m元钱最多能得到多少。 思路:先01背包处理出A+B的情况,再 阅读全文
posted @ 2015-08-26 20:32 Przz 阅读(156) 评论(0) 推荐(0)
摘要:For each test case, in the first line, you should print the maximum sum. In the next line you should print a string consisting of "L","R","U" and "D", 阅读全文
posted @ 2015-08-19 10:15 Przz 阅读(139) 评论(0) 推荐(0)
摘要:Sample Input 5 2 -2 0 2 0 -2 0 5 2 3 2 3 3 3 3 5 2 -2 0 2 0 -2 0 5 2 3 2 3 3 3 3 Sample Output 12 5 12 5 求最多多少序列满足,前半部分满足d(j+1) = d(j)+d1,后半部分d(j+1)= 阅读全文
posted @ 2015-08-19 09:31 Przz 阅读(163) 评论(0) 推荐(0)
摘要:Sample Input 2 abc abaadada 2 abc abaadada Sample Output Yes No Yes No 判断是否能成为3个非空回文子串 manacher算法求出个点回文长度,在找出第一个和最后一个保存下来,再判断中间的 阅读全文
posted @ 2015-08-17 15:34 Przz 阅读(253) 评论(0) 推荐(0)
摘要:Sample Input 2 3 1 3 2 6 2 3 4 5 6 1 2 3 1 3 2 6 2 3 4 5 6 1 Sample Output 2 6 2 6 题意:给一个转置求它的循环长度 题解:分解成循环求最小公倍数 阅读全文
posted @ 2015-08-16 16:03 Przz 阅读(237) 评论(0) 推荐(0)
摘要:Zball in Tina Town Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 1401 Accepted Submission(s) 阅读全文
posted @ 2015-08-16 11:19 Przz 阅读(218) 评论(0) 推荐(0)
摘要:poj 2528 For each input data set print the number of visible posters after all the posters are placed. The picture below illustrates the case of the s 阅读全文
posted @ 2015-08-15 21:20 Przz 阅读(188) 评论(0) 推荐(0)
摘要:poj 3264 Sample Input Sample Output 求任一区间的最大值和最小值的差 poj 3468 Sample Input Sample Output ①对区间i - j 的数全加上c ; ②求区间的和 阅读全文
posted @ 2015-08-15 20:47 Przz 阅读(154) 评论(0) 推荐(0)
摘要:Sample Input 3 0 0 0 3 0 1 5 0 1 0 0 1 1 0 1 0 0 3 0 0 0 3 0 1 5 0 1 0 0 1 1 0 1 0 0 Sample Output Case #1: 0 0 0 Case #2: 0 1 0 2 Case #1: 0 0 0 Case 阅读全文
posted @ 2015-08-14 16:55 Przz 阅读(162) 评论(0) 推荐(0)
摘要:Sample Input 4 3 9 1 1 2 6 3 9 1 2 3 3 5 2 3 1 1 1 1 1 9 9 9 1 2 3 4 5 6 7 8 9 4 3 9 1 1 2 6 3 9 1 2 3 3 5 2 3 1 1 1 1 1 9 9 9 1 2 3 4 5 6 7 8 9 Sampl 阅读全文
posted @ 2015-08-14 11:28 Przz 阅读(158) 评论(0) 推荐(0)
摘要:| 1 2 3 4 5 6 | | 3 6 5 1 4 2 | 在一个置换下,x1->x2,x2->x3,...,xn->x1, 每一个置换都可以唯一的分解为若干个不交的循环 如上面那个 可以 =>(1,3,5,4) 1的下面是3 ;3的下面是5 一直循环。 (2,6) 一个循环,有两种处理方法: 阅读全文
posted @ 2015-08-14 11:07 Przz 阅读(155) 评论(0) 推荐(0)
摘要:Sample Input 1 3 5 2 2 1 2 3 3 2 1 3 3 3 3 3 3 3 3 3 3 H 2 3 L 2 2 H 3 3 H 1 3 L 2 3 1 3 5 2 2 1 2 3 3 2 1 3 3 3 3 3 3 3 3 3 3 H 2 3 L 2 2 H 3 3 H 1 3 阅读全文
posted @ 2015-08-13 22:02 Przz 阅读(134) 评论(0) 推荐(0)
摘要:Sample Input 1 5 6 orz sto kirigiri danganronpa ooooo o kyouko dangan ronpa ooooo ooooo 1 5 6 orz sto kirigiri danganronpa ooooo o kyouko dangan ronpa 阅读全文
posted @ 2015-08-13 20:35 Przz 阅读(175) 评论(0) 推荐(0)
摘要:Sample Input 1 10 2 3 4 4 3 2 2 3 4 4 1 10 2 3 4 4 3 2 2 3 4 4 Sample Output Case #1: 9 要求找出一段数字。 将其分成3部分,第①和第②部分成回文字串,第②和第③部分成回文字串 用manacher算出各个点的回文后 阅读全文
posted @ 2015-08-12 11:58 Przz 阅读(126) 评论(0) 推荐(0)
摘要:Sample Input 2 00?0 1 2 4 8 ???? 1 2 4 8 2 00?0 1 2 4 8 ???? 1 2 4 8 Sample Output Case #1: 12 Case #2: 15 Case #1: 12 Case #2: 15 ?部分可以是0 or 1,将二进制转化 阅读全文
posted @ 2015-08-12 10:38 Przz 阅读(148) 评论(0) 推荐(0)
摘要:Problem Description In this problem, we should solve an interesting game. At first, we have an integer n, then we begin to make some funny change. We 阅读全文
posted @ 2015-08-12 10:10 Przz 阅读(161) 评论(0) 推荐(0)
摘要:反素数: 对于任何正整数,其约数个数记为,例如,如果某个正整数满足:对任意的正整 数,都有,那么称为反素数。 有两个特点: 1.一个反素数的质因子必是从2开始的质数 2.如果,那么必有 最常见的问题如下: (1)给定一个数,求一个最小的正整数,使得的约数个数为 (2)求出中约数个数最多的这个数 即是 阅读全文
posted @ 2015-08-10 15:23 Przz 阅读(217) 评论(0) 推荐(0)
摘要:Sample Input Sample Output 模板学习: 判断是否是素数,数据很大,所以用miller,不是的话再用pollard rho分解 miller : 通过费马小定理,若N为素数,a^(N-1) = 1 (mod N), 再利用二次判定: 若x为素数,0<x<p, x*x = 1( 阅读全文
posted @ 2015-08-09 19:56 Przz 阅读(176) 评论(0) 推荐(0)
摘要:Sample Input Sample Output 找出给定范围内,距离最远和最近的素数。(不停超时 - -) 给的上界很大,所以全处理肯定不行。 先处理sqrt(2147483647)。 然后再在l 与 r之间筛选素数。 阅读全文
posted @ 2015-08-09 15:29 Przz 阅读(220) 评论(0) 推荐(0)
摘要:M斐波那契数列F[n]是一种整数数列,它的定义如下: F[0] = a F[1] = b F[n] = F[n-1] * F[n-2] ( n > 1 ) 现在给出a, b, n,你能求出F[n]的值吗? Input 输入包含多组测试数据; 每组数据占一行,包含3个整数a, b, n( 0 <= a 阅读全文
posted @ 2015-08-09 11:39 Przz 阅读(206) 评论(0) 推荐(0)
摘要:转————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— 阅读全文
posted @ 2015-08-09 10:56 Przz 阅读(326) 评论(0) 推荐(0)
摘要:最短路问题 此类问题类型不多,变形较少 POJ 2449 Remmarguts' Date(中等) http://acm.pku.edu.cn/JudgeOnline/problem?id=2449 题意:经典问题:K短路 解法:dijkstra+A*(rec),方法很多 相关:http://acm 阅读全文
posted @ 2015-08-09 10:48 Przz 阅读(158) 评论(0) 推荐(0)
摘要:模板: int Extend_Euclid(int a, int b, int &x, int &y){ if(b == 0){ x = 1; y = 0; return a; } else{ int gcd,t; gcd = Extend_Euclid(b, a%b, x, y); t = x; 阅读全文
posted @ 2015-08-08 15:04 Przz 阅读(204) 评论(0) 推荐(0)
摘要:hdu2108 判断是否为凸边形 判断连续三点的叉乘 若为凸,内角<180;若为凹,内角>180 所以通过正负来判断 阅读全文
posted @ 2015-08-08 10:18 Przz 阅读(161) 评论(0) 推荐(0)
摘要:Sample Input 143 10 143 20 667 20 667 30 2573 30 2573 40 0 0 143 10 143 20 667 20 667 30 2573 30 2573 40 0 0 Sample Output GOOD BAD 11 GOOD BAD 23 GOO 阅读全文
posted @ 2015-08-07 20:12 Przz 阅读(265) 评论(0) 推荐(0)
摘要:Sample Input 4 8 4 1 3 2 2 1 0 3 5 3 6 4 2 1 7 6 8 3 3 2 0 5 0 3 6 4 5 2 7 7 6 7 6 8 2 2 3 3 3 0 0 2 7 4 3 6 3 2 2 5 8 5 6 5 3 3 1 2 4 6 7 7 6 5 4 3 5 阅读全文
posted @ 2015-08-07 10:56 Przz 阅读(149) 评论(0) 推荐(0)
摘要:Problem Description soda has a set S with n integers {1,2,…,n}. A set is called key set if the sum of integers in the set is an even number. He wants 阅读全文
posted @ 2015-08-06 20:09 Przz 阅读(154) 评论(0) 推荐(0)
摘要:Each soda has some candies in their hand. And they want to make the number of candies the same by doing some taking and giving operations. More specif 阅读全文
posted @ 2015-08-06 19:42 Przz 阅读(175) 评论(0) 推荐(0)
摘要:Problem Description As we all kown, MZL hates the endless loop deeply, and he commands you to solve this problem to end the loop. You are given an und 阅读全文
posted @ 2015-08-05 11:14 Przz 阅读(192) 评论(0) 推荐(0)
摘要:Problem Description MZL is a mysterious mathematician, and he proposed a mysterious function at his young age. Stilwell is very confused about this fu 阅读全文
posted @ 2015-08-04 22:33 Przz 阅读(198) 评论(0) 推荐(0)
摘要:Problem Description A simple problem Problem Description You have a multiple set,and now there are three kinds of operations: 1 x : add number x to se 阅读全文
posted @ 2015-08-04 20:04 Przz 阅读(187) 评论(0) 推荐(0)
摘要:Problem Description MZL loves xor very much.Now he gets an array A.The length of A is n.He wants to know the xor of all (Ai+Aj)(1≤i,j≤n) The xor of an 阅读全文
posted @ 2015-08-04 20:00 Przz 阅读(212) 评论(0) 推荐(0)
摘要:Problem Description There is an integer a and n integers b1,…,bn. After selecting some numbers from b1,…,bn in any order, say c1,…,cr, we want to make 阅读全文
posted @ 2015-08-04 16:13 Przz 阅读(172) 评论(0) 推荐(0)
摘要:Input and Output In order to provide the Quiz Master with a potentially unlimited source of questions you are asked to write a program that will read 阅读全文
posted @ 2015-08-02 21:23 Przz 阅读(191) 评论(0) 推荐(0)
摘要:Given a graph (V,E) where V is a set of nodes and E is a set of arcs in VxV, and an ordering on the elements in V, then the bandwidth of a node v is d 阅读全文
posted @ 2015-08-02 21:12 Przz 阅读(213) 评论(0) 推荐(0)
摘要:描述 小Hi和小Ho准备国庆期间去A国旅游。A国的城际交通比较有特色:它共有n座城市(编号1-n);城市之间恰好有n-1条公路相连,形成一个树形公路网。小Hi计划从A国首都(1号城市)出发,自驾遍历所有城市,并且经过每一条公路恰好两次——来回各一次——这样公路两旁的景色都不会错过。 令小Hi苦恼的是 阅读全文
posted @ 2015-08-02 21:04 Przz 阅读(384) 评论(0) 推荐(0)
摘要:Virtual Participation Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 237 Accepted Submission(s) 阅读全文
posted @ 2015-08-01 18:38 Przz 阅读(206) 评论(0) 推荐(0)