摘要:
传送门POUR1 - Pouring water#gcd#recursionGiven two vessels, one of which can accommodatealitres of water and the other -blitres of water, determine the n... 阅读全文
摘要:
Problem 给出一个不带边权(即边权为1)的有向无环图(unweighted DAG)以及DAG上两点s, t,求s到t的最短距离,如果无法从s走到t,则输出-1。 Solution DFS,BFS都可,对于unweighted DAG, BFS更合适,下面给出DFS解法。 对于weighted 阅读全文
摘要:
传送门 You are given $n$ numbers $a_1, a_2, \dots, a_n$. You can perform at most $k$ operations. For each operation, you can multiply one of the numbers 阅读全文
摘要:
传送门WORDS1 - Play on Words#graph-theory#euler-circuitSome of the secret doors contain avery interesting word puzzle. The team of archaeologists has to ... 阅读全文
摘要:
传送门 确定比赛名次 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17915 Accepted Submission(s): 7169 Pro 阅读全文
摘要:
问题 求 $[L, R]$ 之间的素数表。 解法 一个合数 $n$ 的最小素因子不超过 $\sqrt{n}$。因此,在埃氏筛法的过程中,每当“新发现”一个素数 $p$,可以从 $p^2$ 筛起,而不必从 $2p$ 筛起。 先用埃氏筛法求出 $[1,\lfloor \sqrt{R} \rfloor]$ 阅读全文
摘要:
传送门Ice Cream ParlorAuthored bydheerajonMar 21 2013Problem StatementSunny and Johnny together haveMdollars they want to spend on ice cream. The parlor ... 阅读全文
摘要:
传送门 Sherlock and MiniMax Authored by darkshadows on May 07 2014 Problem Statement Sherlock and MiniMax Authored by darkshadows on May 07 2014 Problem 阅读全文
摘要:
传送门今天在HackerRank上翻到一道高精度题,于是乎就写了个高精度的模板,说是模板其实就只有乘法而已。Extra long factorialsAuthored byvatsalchananaonJun 16 2015Problem StatementYou are given an inte... 阅读全文
摘要:
最长上升公共子序列(Longest Increasing Common Subsequence,LICS)也是经典DP问题,是LCS与LIS的混合。Problem求数列 a[1..n], b[1..m]的LICS的长度, a[], b[]数组的元素均为正整数。Solution考虑如何定义DP状态,定... 阅读全文