Integers1, 2, 3,...,nare placed on a circle in
the increasing order as in the following figure. We want to construct a sequence
from these numbers on ...
分类:
其他好文 时间:
2014-05-14 02:54:10
阅读次数:
354
题目来源:POJ 2478 Farey Sequence
题意:输入n 求 phi(2)+phi(3)+phi(4)+...+phi(n)
思路:用类似筛法的方式计算phi(1), phi(2), ..., phi(n) 再求前缀和
#include
#include
#include
//欧拉phi函数
const int maxn = 1000010;
typedef long...
分类:
其他好文 时间:
2014-05-14 01:05:22
阅读次数:
323
DNA Sorting
Time Limit: 1000MS
Memory Limit: 10000K
Total Submissions: 80359
Accepted: 32327
Description
One measure of ``unsortedness'' in a sequence is the number of ...
分类:
其他好文 时间:
2014-05-13 23:34:18
阅读次数:
303
python中的单元测试可以使用doctest,unittest完成
1.doctest的使用
(1)写入程序如下(cubetest.py):
#!/usr/bin/python
def cube(x):
"""
cube a number and return the result
>>> cube(2)
8
>>> cube(3)
27
>>> cube(4)
64...
分类:
编程语言 时间:
2014-05-13 23:33:19
阅读次数:
491
Gao The SequenceTime Limit:2 Seconds Memory
Limit:65536 KBYou are given a sequence of integers,A1,A2,...,An. And you are
allowed a manipulation on the...
分类:
其他好文 时间:
2014-05-13 19:49:14
阅读次数:
277
Given an array, for example, 246135, an inversion pair is the pair whose first value is larger than its second value according to the sequence from left to right, (2,1) (4,1) (4,3) (6,1) (6,3) (6,5)....
分类:
其他好文 时间:
2014-05-13 08:03:58
阅读次数:
338
又是那种看上去非常简单,但非常难过的问题,主要是所有的测试用例很难考虑全面。下面我列举出所有的情况:
1. 字符串前面是可以含有空格的,但是全部都是空格是不行的。
2. 一个数字开头可以是哪些字符呢?很容易想到的是“+”和“-”,但是别忘记还有小数点。
3. 一个数字中间也是可以含有字符的,比如科学计数法的“e”,而且e之后是可以接“+”或者“-”的。但是要注意e是不是作为数字的开头或者结尾...
分类:
其他好文 时间:
2014-05-13 07:16:48
阅读次数:
232
Number one of the biggest security holes are passwords, as every password security study shows. Hydra is a parallized login cracker which supports numerous protocols to attack. New modules are easy to...
分类:
其他好文 时间:
2014-05-13 06:11:08
阅读次数:
379
本文为senlie原创,转载请保留此地址:http://blog.csdn.net/zhengsenlie
Palindrome Number
Total Accepted: 12165 Total
Submissions: 41736
Determine whether an integer is a palindrome. Do this wit...
分类:
其他好文 时间:
2014-05-13 05:28:07
阅读次数:
253
XceedEditorsforWPF是一款包含12种功能强大的WPF编辑控件,用户输入控件,每个控件都具有多种风格主题,包含:日期选择控件、复选框、改进的TextBox、数字输入框、值范围输入框等。具体功能:DatePicker/Calendar:日期选择控件MaskedTextBox:为输入文本指定一种标记格式CheckB..
分类:
其他好文 时间:
2014-05-13 03:15:42
阅读次数:
278