
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 · 818 阅读 · 0 评论 -
poj 3233 Matrix Power Series
Matrix Power Series Time Limit: 3000MS Memory Limit: 131072K Total Submissions: 15997 Accepted: 6840 Description Given a n × n matrix A and a positive integer k,原创 2014-12-29 14:02:25 · 629 阅读 · 0 评论 -
poj 3070 Fibonacci
Fibonacci Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 9769 Accepted: 6959 Description In the Fibonacci integer sequence, F0 = 0, F1 = 1, and Fn = F原创 2014-12-29 14:29:54 · 671 阅读 · 0 评论 -
poj 1656 Counting Black
Counting Black Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 10360 Accepted: 6691 Description There is a board with 100 * 100 grids as shown below. The原创 2014-12-30 15:14:16 · 796 阅读 · 0 评论 -
BestCoder Round #28
1001 Missing number Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 748 Accepted Submission(s): 275 Problem Description T原创 2015-02-01 08:42:58 · 1121 阅读 · 0 评论 -
poj1845 Sumdiv
Sumdiv Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 15033 Accepted: 3706 Description Consider two natural numbers A and B. Let S be the sum of all nat原创 2015-02-02 18:33:40 · 817 阅读 · 0 评论 -
poj3299 Humidex
Humidex Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 17719 Accepted: 6420 Description Adapted from Wikipedia, the free encyclopedia The humidex is a原创 2015-02-02 20:11:41 · 691 阅读 · 0 评论 -
poj2159 Ancient Cipher
Ancient Cipher Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 29154 Accepted: 9547 Description Ancient Roman empire had a strong government system with原创 2015-02-03 08:21:36 · 925 阅读 · 0 评论 -
poj1083 Moving Tables
Moving Tables Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 26782 Accepted: 8962 Description The famous ACM (Advanced Computer Maker) Company has rente原创 2015-02-03 21:11:57 · 615 阅读 · 0 评论 -
poj 2413 How many Fibs?
How many Fibs? Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10748 Accepted: 3982 Description Recall the definition of the Fibonacci numbers: f1 := 1原创 2014-12-29 01:06:36 · 1138 阅读 · 0 评论 -
poj 3331 The Idiot of the Year Contest!
The Idiot of the Year Contest! Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 3744 Accepted: 1952 Description There is just one basic rule in the Idiot原创 2014-12-24 23:22:37 · 901 阅读 · 0 评论 -
poj1222 EXTENDED LIGHTS OUT
EXTENDED LIGHTS OUT Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 7202 Accepted: 4718 Description In an extended version of the game Lights Out, is a p原创 2015-02-12 20:41:05 · 890 阅读 · 0 评论 -
poj3239 Solution to the n Queens Puzzle (n皇后问题)
Solution to the n Queens Puzzle Time Limit: 1000MS Memory Limit: 131072K Total Submissions: 3494 Accepted: 1285 Special Judge Description The eight queens puz原创 2015-02-06 21:59:21 · 827 阅读 · 0 评论 -
二叉树的遍历
二叉树的链式存储结构是一类重要的数据结构,其形式定义如下: [cpp] view plaincopy //二叉树结点 typedef struct BiTNode{ //数据 char data; //左右孩子指针 struct BiTNode *lchild,*rchild; }BiTNode,*BiTree; 二原创 2015-02-05 09:15:26 · 919 阅读 · 0 评论 -
poj2255 Tree Recovery
Tree Recovery Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11955 Accepted: 7505 Description Little Valentine liked playing with binary trees very much原创 2015-02-04 18:28:21 · 616 阅读 · 0 评论 -
poj3006 Dirichlet's Theorem on Arithmetic Progressions
Dirichlet's Theorem on Arithmetic Progressions Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 16333 Accepted: 8205 Description If a and d are relatively原创 2015-02-03 21:37:04 · 764 阅读 · 0 评论 -
poj 2524 Ubiquitous Religions
Ubiquitous Religions Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 25316 Accepted: 12489 Description There are so many different religions in the world原创 2014-12-19 20:40:28 · 545 阅读 · 0 评论 -
poj 1308 Is It A Tree?
Is It A Tree? Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22790 Accepted: 7814 Description A tree is a well-known data structure that is either empty原创 2014-12-23 23:23:18 · 591 阅读 · 0 评论 -
poj 1611 The Suspects
The Suspects Time Limit: 1000MS Memory Limit: 20000K Total Submissions: 23545 Accepted: 11477 Description Severe acute respiratory syndrome (SARS), an atypical pneu原创 2014-12-23 23:27:52 · 628 阅读 · 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 · 1530 阅读 · 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 · 926 阅读 · 0 评论 -
poj2773 Happy 2006
Happy 2006 Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 9987 Accepted: 3434 Description Two positive integers are said to be relatively prime to each原创 2015-02-25 23:34:46 · 820 阅读 · 0 评论 -
poj1979 Red and Black
Red and Black Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 24058 Accepted: 13007 Description There is a rectangular room, covered with square tiles. E原创 2015-02-18 13:35:14 · 872 阅读 · 0 评论 -
poj2864 Pascal Library
Pascal Library Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5445 Accepted: 2610 Description Pascal University, one of the oldest in the country, needs原创 2015-02-17 21:21:17 · 791 阅读 · 0 评论 -
poj2871 A Simple Question of Chemistry
A Simple Question of Chemistry Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 6666 Accepted: 4426 Description Your chemistry lab instructor is a very en原创 2015-02-17 21:33:34 · 909 阅读 · 0 评论 -
poj2845 01000001
01000001 Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 10571 Accepted: 3345 Description Adding binary numbers is a very simple task, and very similar t原创 2015-02-17 21:39:14 · 871 阅读 · 0 评论 -
poj3663 Costume Party
Costume Party Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 11793 Accepted: 4770 Description It's Halloween! Farmer John is taking the cows to a costum原创 2015-02-20 12:58:22 · 2081 阅读 · 3 评论 -
hdu4578(三个更新操作,三个求值操作)
题意:有长为n的数列,初始化为全部为0,我们对它有三个操作: (1)把数列中的一段区间全部乘一个值; (2)把数列中的一段区间全部加一个值; (3)把数列中的一段区间全部替换成一个值; 然后再对它有一个查询操作: 求数列中的一段区间的每个数的p次方之和(1 解题思路: 因为p只有三个值,所以我们可以将这三个值分别进行求解,我将它们定义为sum,sum2,sum原创 2015-07-15 09:46:42 · 1169 阅读 · 0 评论 -
Treap
Treap Treap=Tree+Heap,Treap是一个二叉搜索树,它的左右子树都分别是一个Treap,和一般二叉排序树不同的是,Treap记录一个额外的数据(v),就是优先级(rank)。Treap在以关键字构成二叉排序树的同时,还满足堆的性质,不过Treap不一定是完全二叉树,而堆必须是完全二叉树. 1.结构体定义: struct data{原创 2015-10-30 11:40:35 · 647 阅读 · 0 评论 -
poj3904 Sky Code
Sky Code Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 1694 Accepted: 523 Description Stancu likes space travels but he is a poor software developer an原创 2015-02-27 18:55:47 · 779 阅读 · 0 评论 -
zoj 1745 Are We There Yet?
Are We There Yet? Time Limit: 2 Seconds Memory Limit: 65536 KB Laurie'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 · 748 阅读 · 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 · 1799 阅读 · 1 评论 -
poj3264 Balanced Lineup(求区间的最大值与最小值之差)
Balanced Lineup Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 37869 Accepted: 17751 Case Time Limit: 2000MS Description For the daily milking, Far原创 2015-05-21 19:59:05 · 958 阅读 · 0 评论 -
poj2299 Ultra-QuickSort(线段树计数问题)
Ultra-QuickSort Time Limit: 7000MS Memory Limit: 65536K Total Submissions: 46293 Accepted: 16846 Description In this problem, you have to analyze原创 2015-05-04 01:11:28 · 1109 阅读 · 0 评论 -
hdu1754 I Hate It
I Hate It Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 45599 Accepted Submission(s): 17897 Problem Description 很多学校流行一种比较的习惯。原创 2015-04-28 09:21:40 · 843 阅读 · 0 评论 -
UVA100 The 3n + 1 problem
The 3n + 1 problem Background Problems 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 · 1094 阅读 · 0 评论 -
zoj2000 Palindrome Numbers
Palindrome Numbers Time Limit: 2 Seconds Memory Limit: 65536 KB A 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 · 772 阅读 · 0 评论 -
poj 1775 && zoj 2358 Sum of Factorials
Sum of Factorials Time Limit: 1000MS Memory Limit: 30000K Description John 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 · 1136 阅读 · 0 评论 -
zoj 1577 GCD & LCM
GCD & LCM Time Limit: 2 Seconds Memory Limit: 65536 KB Given x and y (2 1) p and q are positive integers; 2) GCD(p, q) = x; 3) LCM(p, q) = y. Input x and y, one line for each test原创 2015-04-05 23:46:16 · 688 阅读 · 0 评论 -
poj1047 Round and Round We Go
Round and Round We Go Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 12064 Accepted: 5630 Description A cyclic number is an integer n digits in length w原创 2015-02-06 22:31:59 · 953 阅读 · 0 评论