08 2015 档案
摘要:剪辑地址:http://hzwer.com/3023.html计算两个超级大数的最大公约数:样例:11111111111111111111122222222222222222222222222222输出:我也不知道~~~code:#include#include#include#define inf...
阅读全文
摘要:A. Bear and Electionstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLimak is a grizzly bear who ...
阅读全文
摘要:题目描述In mathematics, a square number is an integer that is the square of an integer. In other words, it is the product of some integer with itself. For...
阅读全文
摘要:Going from u to v or from v to u?Time Limit: 2000MSMemory Limit: 65536KTotal Submissions: 15812Accepted: 4194DescriptionIn order to make their sons br...
阅读全文
摘要:题目地址:http://poj.org/problem?id=2186Popular CowsTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 27496Accepted: 11059DescriptionEvery cow's dre...
阅读全文
摘要:转载地址:https://www.byvoid.com/blog/scc-tarjan[有向图强连通分量]在有向图G中,如果两个顶点间至少存在一条路径,称两个顶点强连通(strongly connected)。如果有向图G的每两个顶点都强连通,称G是一个强连通图。非强连通图有向图的极大强连通子图,称...
阅读全文
摘要:描述小Hi和小Ho本着礼让他们的心情——当然还因为本来他们买的就是站票,老老实实的呆在两节车厢的结合处。他们本以为就能够这样安稳抵达目的地,但 事与愿违,他们这节车厢的乘务员是一个强迫症,每隔一小会总是要清扫一次卫生,而时值深夜,大家都早已入睡,这种行为总是会惊醒一些人。而一旦相邻的一些 乘客被惊醒...
阅读全文
摘要:1.运行如下的代码:#include #include int main(){ int a; a=1; int s[4]; memset(s, 0, sizeof(s)); s[a++]=a++; printf("s[0]=%d\n", s[0]); printf...
阅读全文
摘要:题目地址:http://poj.org/problem?id=1961Sample Input3aaa12aabaabaabaab0Sample OutputTest case #12 23 3Test case #22 26 29 312 4题目分析:给你一个字符串,最大长度1百万。输出是:以第1...
阅读全文
摘要:Power StringsTime Limit: 3000MSMemory Limit: 65536KTotal Submissions: 38038Accepted: 15740DescriptionGiven two strings a and b we define a*b to be th...
阅读全文
摘要:题目地址:http://poj.org/problem?id=2488Sample Input31 12 34 3Sample OutputScenario #1:A1Scenario #2:impossibleScenario #3:A1B3C1A2B4C2A3B1C3A4B2C4题目:给你一个p...
阅读全文
摘要:题目地址:http://poj.org/problem?id=3414PotsTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 12080Accepted: 5104Special JudgeDescriptionYou are giv...
阅读全文
摘要:转载地址:http://m.blog.csdn.net/blog/u010489766/9229011题目链接:http://poj.org/problem?id=1276题意:机器里面共有n种面额的钱币,每种各ni张,求机器吐出小于等于所要求钱币的最大值解析1:这题大牛都用了多重背包,不过,我一同...
阅读全文
摘要:历届试题 打印十字图 时间限制:1.0s 内存限制:256.0MB 题目地址:http://lx.lanqiao.org/problem.page?gpid=T25问题描述小明为某机构设计了一个十字型的徽标(并非红十字会啊),如下所示: 对方同时也需要在电脑dos窗口中以字符的形式输出该标...
阅读全文
摘要:题目地址:http://poj.org/problem?id=167923 31 2 12 3 23 1 34 41 2 22 3 23 4 24 1 2Sample Output3Not Unique!次小生成树学习博客:http://blog.csdn.net/niushuai666/artic...
阅读全文
摘要:题目地址:http://poj.org/problem?id=2828Sample Input40 771 511 332 6940 205231 192431 38900 31492Sample Output77 33 69 5131492 20523 3890 19243HintThe figu...
阅读全文
摘要:/* 遇到素数需要打表时,先估算素数的个数: num = n / lnx; num为大概数字,越大误差越小(只是估计,用于估算素数表数组大小) 这个打表法效率貌似很高,网上说几乎达到了线性时间(不知道是真是假=。=) */ #include ...
阅读全文
摘要:敌兵布阵Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 59891Accepted Submission(s): 25331Problem Desc...
阅读全文
摘要:题目地址:http://poj.org/problem?id=1703Sample Input15 5A 1 2D 1 2A 1 2D 2 4A 1 4Sample OutputNot sure yet.In different gangs.In the same gang.题目解读:T组数据,每组...
阅读全文
摘要:转载地址:http://blog.csdn.net/qwerty_xk/article/details/12749961题:只有2 3 5 这三个因子的数,求第1500个 设1为第一个丑数,求第1500个丑数解法:1 简单的暴力搜索,对每个数进行因子判别,直到搜到第1500个评价:耗时 不可取2 将...
阅读全文
摘要:Expanding RodsTime Limit: 1000MSMemory Limit: 30000KTotal Submissions: 13516Accepted: 3484DescriptionWhen a thin rod of length L is heated n degrees,...
阅读全文
摘要:问题的提出:是否可以用线性数据结构的方法解决动态统计子树权和的问题呢?有的,树状数组。假设当前数组为a[],元素个数为n。1. 子区间的权和数组为sum,那么数组a[]中 i 到 j这段区间的数组元素和为sum[i,j]=a[k]的累加 【k属于(i->j)】2. 现在定义前缀和数组s[],s[i]...
阅读全文
摘要:题目地址:http://poj.org/problem?id=1330Sample Input2161 148 510 165 94 68 44 101 136 1510 116 710 216 38 116 1216 752 33 43 11 53 5Sample Output43n个节点、n-1...
阅读全文
摘要:题目:http://poj.org/problem?id=3080Sample Input32GATACCAGATACCAGATACCAGATACCAGATACCAGATACCAGATACCAGATACCAGATAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
阅读全文
摘要:Robot MotionTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 11462Accepted: 5558DescriptionA robot has been programmed to follow the instruct...
阅读全文
摘要:题目:http://poj.org/problem?id=1265Sample Input241 00 1-1 00 -175 01 3-2 2-1 00 -3-3 10 -3Sample OutputScenario #1:0 4 1.0Scenario #2:12 16 19.0注意:题目给出的...
阅读全文
摘要:Sample Input51 4 2 5 -124-12 1 2 4Sample Output21 4题目:给你两个数字序列,求出这两个序列的最长公共上升子序列。输出最长的长度,并打表输出。可能存在多种正确答案,故此题是special judge!分析:dp[i][j] : A[1...i]和B[1...
阅读全文
摘要:最长公共子序列可以用在下面的问题时:给你一个字符串,请问最少还需要添加多少个字符就可以让它编程一个回文串?解法:ans=strlen(原串)-LCS(原串,反串);Sample Inputabcfbc abfcabprogramming contest abcd ...
阅读全文
摘要:Scanner cin = new Scanner(new BufferedInputStream(System.in));这样定义Scanner类的对象读入数据可能会快一些!参考这个博客继续补充内容:http://blog.csdn.net/lmyclever/article/details/64...
阅读全文
摘要:已用此模板过掉了好几题。#include#define LL long long //以后可以考虑这样写 简洁int n,i,a[500010], b[500010];//需要开辟两个数组LL count(int l,int r)//统计[l ,r]的逆序对数{ LL s=0;//初始化 ...
阅读全文
摘要:short、int 和 long 类型都表示整型值,存储空间的大小不同。一般, short 类型为半个机器字长,int 类型为一个机器字长,而 long 类型为一个或两个机器字长(在 32 位机器中 int 类型和 long 类型通常字长是相同的)。unsigned int 0~4294967295...
阅读全文
摘要:给一个正整数n,将n分解为质因数。说明:n的质因数要么是n本身(n是素数),要么一定小于等于sqrt(n)。因此可以用小于等于sqrt(n)的数对n进行试除,一直除到不能除为止。这时候剩下的数如果不是1,那就是n最大的质因数。举例说明:100=2^2 * 5^2 ;模板代码: 1 //整数的唯一分解...
阅读全文
摘要:题目地址:http://poj.org/problem?id=1419Graph ColoringTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 4468Accepted: 2042Special JudgeDescriptionYo...
阅读全文
摘要:题目地址:http://poj.org/problem?id=1065Sample Input3 5 4 9 5 2 2 1 3 5 1 4 3 2 2 1 1 2 2 3 1 3 2 2 3 1 Sample Output213题目抽象:给你一个序列,序列的每个元素包含两个值(x,y).现在希望找...
阅读全文
摘要:题目地址:http://poj.org/problem?id=3126InputOne line with a positive number: the number of test cases (at most 100). Then for each test case, one line wit...
阅读全文
摘要:题目地址:http://hihocoder.com/contest/hiho57/problem/1输入第1..5行:1个长度为6的字符串,表示该行的格子状态,1表示该格子是亮着的,0表示该格子是暗的。保证一定存在解,且一定存在暗着的格子。输出需要按下的格子数量k,表示按下这k个位置后就可以将整个游...
阅读全文
摘要:EqsTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 13955Accepted: 6851DescriptionConsider equations having the following form: a1x13+ a2x23+ ...
阅读全文
摘要:题目地址:http://poj.org/problem?id=1019Number SequenceTime Limit: 1000MSMemory Limit: 10000KTotal Submissions: 35680Accepted: 10287DescriptionA single pos...
阅读全文