摘要:传送门 1 /* 2 * input: an expression seperated by a '-' or '+'; for example: a-b, a+b 3 * ouput: the answer of the input expression 4 */ 5 #includ...
阅读全文
摘要:传送门题意:求区间[a, b]中二进制位为1的个数最多的那个数,如果存在多解,则输出最小的那个。(0 2 3 typedef long long ll; 4 5 int main(void) { 6 int n; 7 scanf("%d", &n); 8 while (...
阅读全文
摘要:题目链接最后一题是Splay...还没有学会。。蒟蒻!!!A 1 /************************************************************************* 2 > File Name: A.cpp 3 > Author: S...
阅读全文
摘要:题目链接In a rooted tree, thelowest common ancestor(or LCA for short) of two verticesuandvis defined as the lowest vertex that is ancestor of both that tw...
阅读全文
摘要:题目链接很遗憾。看到第五题的通过人数就不敢做了。待日后补上。A题求最长的连续子序列,使得他们满足gcd为1。如果有相邻的两个数的gcd为1,那么整个序列的gcd值也就是1,否则就是该序列不存在。 1 /*************************************************...
阅读全文
摘要:这套题目只做了几个相对简单的。其他的做起来比较吃力。A找下规律 1 /************************************************************************* 2 > File Name: A.cpp 3 > Author: ...
阅读全文
摘要:题目链接Yet another game from chef. Chef gives youNcards andMbags. Each of theNcards has an integer written on it. Now chef asks you to close your eyes an...
阅读全文
摘要:题目链接Earthquake in Bytetown! Situation is getting out of control!All buildings in Bytetown stand on straight line. The buildings are numbered0, 1, ...,...
阅读全文
摘要:A题简单模拟。 1 /************************************************************************* 2 > File Name: A.cpp 3 > Author: Stomach_ache 4 > Mai...
阅读全文
摘要:A题给一个由a和b两种类型的字符组成的字符串,每次可以从中选取任意长度的回文子序列(不一定连续)并删除。问最少需要几次能将整个字符串为空。思路:如果本身是个回文串,那么只需要一次,否则需要两次(第一次选全部的a,第二次全部选b)。Accepted Code: 1 def is_palidrome(s...
阅读全文