随笔分类 - 思维题
摘要:1 class Solution { 2 public: 3 int countSubstrings(string s) { 4 int n = s.size(), sum = 0; 5 for(int i = 0; i < n*2-1; i++) 6 { 7 int l = i / 2, r =
阅读全文
摘要:a^a = 0 一个数异或任何一个数偶数次值不变
阅读全文
摘要:参考博客:传送门 问题:如何求二叉树两个节点的最大路径
阅读全文
摘要:原题链接http://codeforces.com/contest/897/problem/C What are you doing at the end of the world? Are you busy? Will you save us? 原题链接http://codeforces.com/
阅读全文
摘要:While Vasya finished eating his piece of pizza, the lesson has already started. For being late for the lesson, the teacher suggested Vasya to solve on
阅读全文
摘要:Recenlty Luba got a credit card and started to use it. Let's consider n consecutive days Luba uses the card. She starts with 0 money on her account. I
阅读全文
摘要:You have got a cylindrical cup. Its bottom diameter is 2 units and its height is 2 units as well. The height of liquid level in the cup is d (0 ≤ d ≤
阅读全文
摘要:Josephus Problem The historian Flavius Josephus relates how, in the Romano-Jewish conflict of 67 A.D., the Romans took the town of Jotapata which he w
阅读全文
摘要:I Love This Game Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7987 Accepted Submission(s): 273
阅读全文
摘要:Calculate S(n) Problem Description Calculate S(n).S(n)=13+23 +33 +......+n3 . Input Each line will contain one integer N(1 < n < 1000000000). Process
阅读全文
摘要:题目描述 那么大奶牛之神把一个神秘数字通过信使传递给了奶牛们,但由于信件上出现了偏差,一个数字变成了两个数字,现在你需要通过这两个数字还原出大么大奶牛之神给的神秘数字。需要用第二个数字通过加(+),减(-),乘(*),除(/),次幂(^),阶乘(!),开平方(√)这几个符号凑出第一个数字。使用第二个
阅读全文
摘要:题目描述 NEUQ的谷神要和我赌一个游戏:谷神要求我随机在纸上写出整数集合{1,2,3,...,3n+1}(n是整数)的一个排列(即不重复的随机写出从1到3n+1的所有整数)。并且要求在我写的过程中,从我写的第一个数开始一直加到我正在写的数的总和不被3整除。如果我能写出来符合要求的一个排列,那么我就
阅读全文
摘要:Number Sequence Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 171693 Accepted Submission(s): 42
阅读全文
摘要:Problem Description Given a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7
阅读全文
摘要:As is known to all,the ASCII of character 'a' is 97. Now,find out how many character 'a' in a group of given numbers. Please note that the numbers her
阅读全文
摘要:One spring day on his way to university Lesha found an array A. Lesha likes to split arrays into several parts. This time Lesha decided to split the a
阅读全文

浙公网安备 33010602011771号