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), the max sum in th ...
分类:
其他好文 时间:
2018-07-29 12:57:04
阅读次数:
158
Calculate a + b and output the sum in standard format -- that is, the digits must be separated into groups of three by commas (unless there are less t ...
分类:
其他好文 时间:
2018-07-29 11:55:14
阅读次数:
177
The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room ...
分类:
其他好文 时间:
2018-07-28 18:19:26
阅读次数:
142
A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a re ...
分类:
其他好文 时间:
2018-07-28 12:07:02
阅读次数:
126
http://acm.hdu.edu.cn/showproblem.php?pid=2058 Problem Description Given a sequence 1,2,3,......N, your job is to calculate all the possible sub-seque ...
分类:
其他好文 时间:
2018-07-28 00:13:19
阅读次数:
119
欧拉筛可以$O(n)$筛素数,其本质是拿每个合数的最小质因子把这个合数筛掉。 cpp void prime(int m) { memset(flag, 1, sizeof flag); cnt = 0; for(int i=2; i ...
分类:
其他好文 时间:
2018-07-27 18:09:49
阅读次数:
149
1 bool Is_Prime(int n){ 2 if (n < 2) return false; 3 for (int i = 2; i <= sqrt(n); i++){ 4 if (n%i == 0) return false; 5 } 6 return true; 7 } ...
分类:
其他好文 时间:
2018-07-26 18:44:39
阅读次数:
114
https://www.lydsy.com/JudgeOnline/problem.php?id=2705 先化简。。 化简出来,这个函数就是$id*id*\mu=id*\varphi$ 可以暴力枚举n的因子求。。 ...
分类:
其他好文 时间:
2018-07-26 18:29:47
阅读次数:
123
尽管能计算得到尾后指针,但这种用法极易出错。为了让指针的使用更简单、更安全,c++新标准引入了两个名为begin和end的函数。这两个函数与容器中的两个同名成员功能类似,不过数组毕竟不是类类型,因此这两个函数不是成员函数。正确的使用形式是将数组作为它们的参数: 不能用动态数组 这两个函数定义在ite ...
分类:
编程语言 时间:
2018-07-26 15:17:41
阅读次数:
185
让我们定义d?n??为:d?n??=p?n+1???p?n??,其中p?i??是第i个素数。显然有d?1??=1,且对于n>1有d?n??是偶数。“素数对猜想”认为“存在无穷多对相邻且差为2的素数”。 现给定任意正整数N(<),请计算不超过N的满足猜想的素数对的个数。 输入格式: 输入在一行给出正整 ...
分类:
其他好文 时间:
2018-07-25 20:13:10
阅读次数:
172