![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
OJ编程
文章平均质量分 80
JinbaoSite0144
在你想要放弃的那一刻,想想为什么当初坚持走到了这里!
展开
-
并查集(初级)小结
并查集定义:https://zh.wikipedia.org/wiki/%E5%B9%B6%E6%9F%A5%E9%9B%86/*并查集模板*/int parent[MAXN];int rank[MAXN];void init(int n){ for (int i=0;i<=n;i++){ parent[i]=i; rank[i]=0;原创 2015-07-21 20:12:49 · 790 阅读 · 0 评论 -
poj 3233 Matrix Power Series
Matrix Power SeriesTime Limit: 3000MS Memory Limit: 131072KTotal Submissions: 15997 Accepted: 6840DescriptionGiven a n × n matrix A and a positive integer k,原创 2014-12-29 14:02:25 · 606 阅读 · 0 评论 -
poj 3070 Fibonacci
FibonacciTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 9769 Accepted: 6959DescriptionIn the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = F原创 2014-12-29 14:29:54 · 649 阅读 · 0 评论 -
poj 1656 Counting Black
Counting BlackTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 10360 Accepted: 6691DescriptionThere is a board with 100 * 100 grids as shown below. The原创 2014-12-30 15:14:16 · 766 阅读 · 0 评论 -
BestCoder Round #28
1001Missing numberTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 748 Accepted Submission(s): 275Problem DescriptionT原创 2015-02-01 08:42:58 · 1098 阅读 · 0 评论 -
poj1845 Sumdiv
SumdivTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 15033 Accepted: 3706DescriptionConsider two natural numbers A and B. Let S be the sum of all nat原创 2015-02-02 18:33:40 · 784 阅读 · 0 评论 -
poj3299 Humidex
HumidexTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 17719 Accepted: 6420DescriptionAdapted from Wikipedia, the free encyclopediaThe humidex is a原创 2015-02-02 20:11:41 · 660 阅读 · 0 评论 -
poj2159 Ancient Cipher
Ancient CipherTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 29154 Accepted: 9547DescriptionAncient Roman empire had a strong government system with原创 2015-02-03 08:21:36 · 896 阅读 · 0 评论 -
poj1083 Moving Tables
Moving TablesTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 26782 Accepted: 8962DescriptionThe famous ACM (Advanced Computer Maker) Company has rente原创 2015-02-03 21:11:57 · 582 阅读 · 0 评论 -
poj 2413 How many Fibs?
How many Fibs?Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10748 Accepted: 3982DescriptionRecall the definition of the Fibonacci numbers: f1 := 1原创 2014-12-29 01:06:36 · 1101 阅读 · 0 评论 -
poj 3331 The Idiot of the Year Contest!
The Idiot of the Year Contest!Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 3744 Accepted: 1952DescriptionThere is just one basic rule in the Idiot原创 2014-12-24 23:22:37 · 849 阅读 · 0 评论 -
poj1222 EXTENDED LIGHTS OUT
EXTENDED LIGHTS OUTTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 7202 Accepted: 4718DescriptionIn an extended version of the game Lights Out, is a p原创 2015-02-12 20:41:05 · 870 阅读 · 0 评论 -
poj3239 Solution to the n Queens Puzzle (n皇后问题)
Solution to the n Queens PuzzleTime Limit: 1000MS Memory Limit: 131072KTotal Submissions: 3494 Accepted: 1285 Special JudgeDescriptionThe eight queens puz原创 2015-02-06 21:59:21 · 795 阅读 · 0 评论 -
二叉树的遍历
二叉树的链式存储结构是一类重要的数据结构,其形式定义如下:[cpp] view plaincopy//二叉树结点 typedef struct BiTNode{ //数据 char data; //左右孩子指针 struct BiTNode *lchild,*rchild; }BiTNode,*BiTree; 二原创 2015-02-05 09:15:26 · 879 阅读 · 0 评论 -
poj2255 Tree Recovery
Tree RecoveryTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11955 Accepted: 7505DescriptionLittle Valentine liked playing with binary trees very much原创 2015-02-04 18:28:21 · 582 阅读 · 0 评论 -
poj3006 Dirichlet's Theorem on Arithmetic Progressions
Dirichlet's Theorem on Arithmetic ProgressionsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 16333 Accepted: 8205DescriptionIf a and d are relatively原创 2015-02-03 21:37:04 · 743 阅读 · 0 评论 -
poj 2524 Ubiquitous Religions
Ubiquitous ReligionsTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 25316 Accepted: 12489DescriptionThere are so many different religions in the world原创 2014-12-19 20:40:28 · 518 阅读 · 0 评论 -
poj 1308 Is It A Tree?
Is It A Tree?Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 22790 Accepted: 7814DescriptionA tree is a well-known data structure that is either empty原创 2014-12-23 23:23:18 · 568 阅读 · 0 评论 -
poj 1611 The Suspects
The SuspectsTime Limit: 1000MS Memory Limit: 20000KTotal Submissions: 23545 Accepted: 11477DescriptionSevere acute respiratory syndrome (SARS), an atypical pneu原创 2014-12-23 23:27:52 · 604 阅读 · 0 评论 -
线段树多lazy-tag(两个)
线段树多lazy-tag(两个)题意:有长为N的数列,不妨设为a1,a2,…,aN 。有如下三种操作形式: (1)把数列中的一段数全部乘一个值; (2)把数列中的一段数全部加一个值; (3)询问数列中的一段数的和,由于答案可能很大,你只需输出这个数模P的值。 解题思路: 结构体定义:typdef long long ll;struct Node{ int l,r; l原创 2015-07-13 21:18:07 · 1493 阅读 · 1 评论 -
poj2528 Mayor's posters(线段树,离散化)
离散化的思想:对于这样的数据(3,10000),(9,1000000),(5,100000),(1,1000),(7,1000000)我们可以将其处理为(2,7),(5,9),(3,8),(1,6),(4,9)我们再对离散化之后的数据进行处理就行了。题目意思:n(n求出最后还能看见多少张海报。参考代码:原创 2015-07-10 16:37:34 · 902 阅读 · 0 评论 -
poj2773 Happy 2006
Happy 2006Time Limit: 3000MS Memory Limit: 65536KTotal Submissions: 9987 Accepted: 3434DescriptionTwo positive integers are said to be relatively prime to each原创 2015-02-25 23:34:46 · 796 阅读 · 0 评论 -
poj1979 Red and Black
Red and BlackTime Limit: 1000MS Memory Limit: 30000KTotal Submissions: 24058 Accepted: 13007DescriptionThere is a rectangular room, covered with square tiles. E原创 2015-02-18 13:35:14 · 849 阅读 · 0 评论 -
poj2864 Pascal Library
Pascal LibraryTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 5445 Accepted: 2610DescriptionPascal University, one of the oldest in the country, needs原创 2015-02-17 21:21:17 · 751 阅读 · 0 评论 -
poj2871 A Simple Question of Chemistry
A Simple Question of ChemistryTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6666 Accepted: 4426DescriptionYour chemistry lab instructor is a very en原创 2015-02-17 21:33:34 · 881 阅读 · 0 评论 -
poj2845 01000001
01000001Time Limit: 1000MS Memory Limit: 65536KTotal Submissions: 10571 Accepted: 3345DescriptionAdding binary numbers is a very simple task, and very similar t原创 2015-02-17 21:39:14 · 834 阅读 · 0 评论 -
poj3663 Costume Party
Costume PartyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11793 Accepted: 4770DescriptionIt's Halloween! Farmer John is taking the cows to a costum原创 2015-02-20 12:58:22 · 2043 阅读 · 3 评论 -
hdu4578(三个更新操作,三个求值操作)
题意:有长为n的数列,初始化为全部为0,我们对它有三个操作:(1)把数列中的一段区间全部乘一个值; (2)把数列中的一段区间全部加一个值; (3)把数列中的一段区间全部替换成一个值;然后再对它有一个查询操作:求数列中的一段区间的每个数的p次方之和(1解题思路: 因为p只有三个值,所以我们可以将这三个值分别进行求解,我将它们定义为sum,sum2,sum原创 2015-07-15 09:46:42 · 1127 阅读 · 0 评论 -
Treap
Treap Treap=Tree+Heap,Treap是一个二叉搜索树,它的左右子树都分别是一个Treap,和一般二叉排序树不同的是,Treap记录一个额外的数据(v),就是优先级(rank)。Treap在以关键字构成二叉排序树的同时,还满足堆的性质,不过Treap不一定是完全二叉树,而堆必须是完全二叉树. 1.结构体定义:struct data{原创 2015-10-30 11:40:35 · 624 阅读 · 0 评论 -
poj3904 Sky Code
Sky CodeTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1694 Accepted: 523DescriptionStancu likes space travels but he is a poor software developer an原创 2015-02-27 18:55:47 · 743 阅读 · 0 评论 -
zoj 1745 Are We There Yet?
Are We There Yet?Time Limit: 2 Seconds Memory Limit: 65536 KBLaurie's little brother Joey has been playing Find the Cookie with her. However, after the 32,767th time, Laurie is tired of i原创 2015-03-31 12:57:19 · 709 阅读 · 0 评论 -
hdu4565 So Easy!(矩阵快速幂)
题意:告诉你a,b,n,m,求0解题思路: 我们首先对(a+sqrt(b))^n进行处理,由a+sqrt(b))^n的展开式我们可以知道(a+sqrt(b))^n = Xn + Yn * sqrt(b);那么( a + sqrt( b ) )^( n + 1 ) = ( a + sqrt( b ) ) * ( Xn + Yn * sqrt(b) ) = (原创 2015-07-09 18:05:55 · 1771 阅读 · 1 评论 -
poj3264 Balanced Lineup(求区间的最大值与最小值之差)
Balanced LineupTime Limit: 5000MS Memory Limit: 65536KTotal Submissions: 37869 Accepted: 17751Case Time Limit: 2000MSDescriptionFor the daily milking, Far原创 2015-05-21 19:59:05 · 923 阅读 · 0 评论 -
poj2299 Ultra-QuickSort(线段树计数问题)
Ultra-QuickSortTime Limit: 7000MSMemory Limit: 65536KTotal Submissions: 46293Accepted: 16846DescriptionIn this problem, you have to analyze原创 2015-05-04 01:11:28 · 1072 阅读 · 0 评论 -
hdu1754 I Hate It
I Hate ItTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 45599 Accepted Submission(s): 17897Problem Description很多学校流行一种比较的习惯。原创 2015-04-28 09:21:40 · 804 阅读 · 0 评论 -
UVA100 The 3n + 1 problem
The 3n + 1 problem BackgroundProblems in Computer Science are often classified as belonging to a certain class of problems (e.g., NP, Unsolvable, Recursive). In this problem you will b原创 2015-04-20 17:17:23 · 1056 阅读 · 0 评论 -
zoj2000 Palindrome Numbers
Palindrome NumbersTime Limit: 2 Seconds Memory Limit: 65536 KBA palindrome is a word, number, or phrase that reads the same forwards as backwards. For example, the name "anna" is a palind原创 2015-04-15 23:27:33 · 728 阅读 · 0 评论 -
poj 1775 && zoj 2358 Sum of Factorials
Sum of FactorialsTime Limit: 1000MSMemory Limit: 30000KDescriptionJohn von Neumann, b. Dec. 28, 1903, d. Feb. 8, 1957, was a Hungarian-American mathematician who made important contr原创 2015-04-05 11:43:41 · 1098 阅读 · 0 评论 -
zoj 1577 GCD & LCM
GCD & LCMTime Limit: 2 Seconds Memory Limit: 65536 KBGiven x and y (2 1) p and q are positive integers;2) GCD(p, q) = x;3) LCM(p, q) = y.Inputx and y, one line for each test原创 2015-04-05 23:46:16 · 650 阅读 · 0 评论 -
poj1047 Round and Round We Go
Round and Round We GoTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 12064 Accepted: 5630DescriptionA cyclic number is an integer n digits in length w原创 2015-02-06 22:31:59 · 916 阅读 · 0 评论