题目:有40个培养皿,每个培养皿中有一个数字(0-9)。最开始时20号中数字为1,其余为0。
每组输入有一个DNA programs(10个数字构成的序列),它决定每个培养皿下个时间的数字。
设培养皿i中的数字为F(i),则下次其中的数字为DNA(F(i-1)+F(i)+F(i+1))
{即,编号为F(i-1)+F(i)...
分类:
其他好文 时间:
2014-06-15 19:21:09
阅读次数:
249
题目
The count-and-say sequence is the sequence of integers beginning as follows:
1, 11, 21, 1211, 111221, ...
1 is read off as "one
1" or 11.
11 is read off as "two
1s" or 21.
21 i...
分类:
其他好文 时间:
2014-06-15 18:51:33
阅读次数:
220
题目:再一句话里面有P,I,U中的2个已知量,求第三个未知量。(P=I*U)
分析:字符串。利用'='定位已知量,然后将'='后面的的数字和单位分别读入处理。
说明:注意单位有m(10^-3),k(10^3),M(10^6)的前缀,以及小数点的处理。
#include
#include
#include
#include
using namespace std;
char Sat...
分类:
其他好文 时间:
2014-06-15 17:48:02
阅读次数:
199
1、假clone,虚拟机只是将对象的内存地址clone了一份,修改克隆后的对象内容,将影响原对象
public class Employee{
public Employee(){
}
public Employee(String name, int age){
this.age = age;
this.name = name;
...
分类:
编程语言 时间:
2014-06-15 16:33:26
阅读次数:
295
示例中有详细注释,直接上代码:
#include
#include
using std::cout;
using std::endl;
using std::string;
int main(void){
string str1="hi,test,hello";
string str2="test";
//搜索子串,返回子串第一个字符的索引
cout << st...
分类:
编程语言 时间:
2014-06-15 16:19:55
阅读次数:
233
一道字符串倒置的题目,不是全部倒置,而是每个单词倒置,单词之间顺序不变。
这道题目应该是很经典的,好多次看到,包含编程珠玑的案例,典型的O(n)算法,每个word倒置,再整个string倒置。
这次要上战场了,却发现C C++的 字符串函数不熟练了,最近写的都是Java,一个Split函数爽到爆,于是决定要吧C C++的常用字符串函数过一遍,
并对各种方法实现,此处总结下Sp...
分类:
编程语言 时间:
2014-06-15 08:54:30
阅读次数:
262
nixio.syslog("string") 函数用来debug luci
http://luci.subsignal.org/api/nixio/modules/nixio.html...
分类:
其他好文 时间:
2014-06-15 08:53:30
阅读次数:
1593
compare函数用来进行字符串以及其子串的比较,示例如下:
#include
#include
#include
using std::cout;
using std::endl;
using std::cin;
using std::string;
int main(void){
const int maxlength=100;
string str1="hi,t...
分类:
编程语言 时间:
2014-06-15 08:52:26
阅读次数:
287