- 博客(22)
- 资源 (1)
- 收藏
- 关注
原创 POJ 3009 Curling 2.0【深度优先搜索】
DescriptionOn Planet MM-21, after their Olympic games this year, curling is getting popular. But the rules are somewhat different from ours. The game is played on an ice game board on which a squa
2015-02-17 15:56:46
395
转载 并查集详解
并查集是我暑假从高手那里学到的一招,觉得真是太精妙的设计了。以前我无法解决的一类问题竟然可以用如此简单高效的方法搞定。不分享出来真是对不起party了。(party:我靠,关我嘛事啊?我跟你很熟么?)来看一个实例,杭电1232畅通工程首先在地图上给你若干个城镇,这些城镇都可以看作点,然后告诉你哪些对城镇之间是有道路直接相连的。最后要解决的是整幅图的连通性问题。比如随意给你两个点,让你判
2015-02-13 18:55:59
345
原创 HDU 1709 The Balance【特殊母函数】
Problem DescriptionNow you are asked to measure a dose of medicine with a balance and a number of weights. Certainly it is not always achievable. So you should find out the qualities which cannot be
2015-02-05 23:55:35
362
转载 区间覆盖问题
1)区间完全覆盖问题问题描述:给定一个长度为m的区间,再给出n条线段的起点和终点(注意这里是闭区间),求最少使用多少条线段可以将整个区间完全覆盖样例:区间长度8,可选的覆盖线段[2,6],[1,4],[3,6],[3,7],[6,8],[2,4],[3,5]解题过程:1将每一个区间按照左端点递增顺序排列,拍完序后为[1,4],[2,4],[2,6],[3,5
2015-01-24 12:36:09
418
原创 高效素数打表法
在网上看到的一种方法, 觉得很不错所以自己敲了一份记一下。。比较省时间。。#include #include #include using namespace std;int prime[100010];bool is_prime[10001000];int main(){ int i, j, k; memset(is_prime, true, siz
2014-12-26 12:12:17
458
原创 POJ 1269 Intersecting Lines
DescriptionWe all know that a pair of distinct points on a plane defines a line and that a pair of lines on a plane will intersect in one of three ways: 1) no intersection because they are parallel,
2014-12-19 16:49:58
282
原创 【习题3-9】UVA - 10340 All in All
DescriptionYou have devised a new encryption technique which encodes a message by inserting between its characters randomly generated strings in a clever way. Because of pending patent issues we w
2014-12-15 21:13:34
337
原创 【习题3-8】 UVA - 202 Repeating Decimals
DescriptionThe decimal expansion of the fraction 1/33 is tex2html_wrap_inline43 , where the tex2html_wrap_inline45 is used to indicate that the cycle 03 repeats indefinitely with no intervening di
2014-12-15 21:02:17
539
原创 【习题3-7】 UVA - 1368 DNA Consensus String
DescriptionDNA (Deoxyribonucleic Acid) is the molecule which contains the genetic instructions. It consists of four different nucleotides, namely Adenine, Thymine, Guanine, and Cytosine as shown i
2014-12-14 21:03:50
438
原创 【习题3-6】UVA - 232 Crossword Answers
DescriptionA crossword puzzle consists of a rectangular grid of black and white squares and two lists of definitions (or descriptions).One list of definitions is for ``words" to be written left
2014-12-14 19:45:44
552
原创 【习题3-5】 UVA - 227 Puzzle
DescriptionA children's puzzle that was popular 30 years ago consisted of a 5x5 frame which contained 24 small squares of equal size. A unique letter of the alphabet was printed on each small squa
2014-12-14 12:56:50
443
原创 【习题3-4】UVA - 455 Periodic Strings
DescriptionA character string is said to have period k if it can be formed by concatenating one or more repetitions of another string of length k. For example, the string "abcabcabcabc" has period
2014-12-14 12:07:51
421
原创 【习题3-3】 UVA - 1225 Digit Counting
DescriptionTrung is bored with his mathematics homeworks. He takes a piece of chalk and starts writing a sequence of consecutive integers starting with 1 to N(1 < N < 10000) . After that, he count
2014-12-14 11:57:53
357
原创 【习题3-2】 UVA - 1586 Molar mass
DescriptionAn organic compound is any member of a large class of chemical compounds whose molecules contain carbon. The molar mass of an organic compound is the mass of one mole of the organic com
2014-12-14 11:51:20
499
原创 【习题3-1】 UVA - 1585 Score
DescriptionThere is an objective test result such as ``OOXXOXXOOO". An `O' means a correct answer of a problem and an `X' means a wrong answer. The score of each problem of this test is calculated
2014-12-13 22:38:28
442
原创 nyist - 139 - 我排第几个【康托展开应用】
题目:http://acm.nyist.net/JudgeOnline/problem.php?pid=139描述:现在有"abcdefghijkl”12个字符,将其所有的排列中按字典序排列,给出任意一种排列,说出这个排列在所有的排列中是第几小的?此题较简单,为康托展开的应用。。康托和逆康托展开:http://blog.youkuaiyun.com/qq_2298635
2014-12-05 14:31:03
390
转载 【数学】康托和逆康托展开(全排列顺序问题)
康托展开:X=an*(n-1)!+an-1*(n-2)!+...+ai*(i-1)!+...+a2*1!+a1*0!ai为整数,并且0 应用实例:{1,2,3,4,...,n}的排列总共有n!种,将它们从小到大排序,怎样知道其中一种排列是有序序列中的第几个?如 {1,2,3} 按从小到大排列一共6个:123 132 213 231 312 321。想
2014-12-05 14:07:05
390
原创 nyist - 阶乘因式分解(二) and 阶乘因式分解(一)
题目:http://acm.nyist.net/JudgeOnline/problem.php?pid=56(一)描述:给定两个数m,n,其中m是一个素数。将n(0题目:http://acm.nyist.net/JudgeOnline/problem.php?pid=70(二)描述:给定两个数n,m,其中m是一个素数。将n(0注:^为求幂符号。
2014-12-04 12:23:32
588
原创 nyist 46 - 最少乘法次数
题目:http://acm.nyist.net/JudgeOnline/problem.php?pid=46描述:给你一个非零整数,让你求这个数的n次方,每次相乘的结果可以在后面使用,求至少需要多少次乘。如24:2*2=22(第一次乘),22*22=24(第二次乘),所以最少共2次;题目较为简单,考察二进制的思想。考虑将同底数的乘法转换为幂的加法,即:k^a *
2014-12-04 12:04:05
379
原创 HDU 2054 A == B? 【字符串】
Problem DescriptionGive you two numbers A and B, if A is equal to B, you should print "YES", or print "NO". Inputeach test case contains two numbers A and B.Outputfor each case, if A is
2014-11-15 13:35:51
507
原创 HDU 2082 找单词【母函数】
Problem Description假设有x1个字母A, x2个字母B,..... x26个字母Z,同时假设字母A的价值为1,字母B的价值为2,..... 字母Z的价值为26。那么,对于给定的字母,可以找到多少价值 Input输入首先是一个整数N,代表测试实例的个数。然后包括N行数据,每行包括26个 Output对于每个测试实例,请输出能找到的总价
2014-11-15 12:42:55
381
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人