摘要:
You are given two strings a and b. You have to remove the minimum possible number of consecutive (standing one after another) characters from string b 阅读全文
摘要:
You are given a tree (an undirected acyclic connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. Each edge has an integer value assigned t 阅读全文
摘要:
There are n houses in the village and some bidirectional roads connecting them. Every day peole always like to ask like this "How far is it if I want 阅读全文
摘要:
推荐博客 : http://blog.csdn.net/lw277232240/article/details/72870644 LCA 就是去寻找最近公共祖先 ,如上图中 10 与 11 的LCA是 6 ,7 和 12 的LCA 是 4 。 通过这个我们可以解决的一类问题就是 求任意两点之间的距离 阅读全文
摘要:
int a[100000010]; int main() { int i,len,n; while(scanf("%d",&n)!=EOF){ a[1]=1; len=1; for(int k=2;k=10) { a[i+1]+=a[i]/10; a[i]%=10; ... 阅读全文
摘要:
Bizon the Champion isn't just attentive, he also is very hardworking. Bizon the Champion decided to paint his old fence his favorite color, orange. Th 阅读全文
摘要:
Let D(x) be the number of positive divisors of a positive integer x. For example, D(2) = 2 (2 is divisible by 1 and 2), D(6) = 4 (6 is divisible by 1, 阅读全文
摘要:
如何 快速求一个数的因数的个数 问题 2 : 如何求 1 - n 里所有数约数个数的总和 ? 对于一个所要求的数 n ,我们要求的就是遍历 1 - n , 找有几个数是此数的倍数,将结果累加就可以。 问题3 : 如何求 1 - n 里所有数约数个数最多的数是哪个? 约数定理 : 任意一个数都可以写成 阅读全文
摘要:
C. Swap Adjacent Elements time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You have an arr 阅读全文
摘要:
题目描述 小W在计算一个数列{An},其中A1=1,A2=2,An+2=An+1+An。尽管他计算非常精准,但很快他就弄混了自己的草稿纸,他找出了一些他计算的结果,但他忘记了这些都是数列中的第几项。 输入描述: 每行包括数列中的一项Ak(k<=100000)。 总行数T<=30。 输出描述: 对于每 阅读全文