- 博客(12)
- 收藏
- 关注
原创 Biorhythms问题
Description人生来就有三个生理周期,分别为体力、感情和智力周期,它们的周期长度为23天、28天和33天。每一个周期中有一天是高峰。在高峰这天,人会在相应的方面表现出色。例如,智力周期的高峰,人会思维敏捷,精力容易高度集中。因为三个周期的周长不同,所以通常三个周期的高峰不会落在同一天。对于每个人,我们想知道何时三个高峰落在同一天。对于每个周期,我们会给出从当前年份的第一天开始,到出现高
2016-09-26 21:39:05
356
原创 穷举搜索:Google方程式
有一个由字符组成的方程式:WWWDOT-GOOGLE=DOTCOM 每一个字母代表一个不同的数字,不能以0开头。使用穷举法就是对每个字母用0~9的数字尝试10次,由于没一个字母代表不同的数字,如果考虑0开头的情况,这样的组合有10*9*8*7*6*5*4*3*2*1=3628800组合。数据结构的定义上,要避免固定9个字符的方法,就需要定义一可变化的字符元素列表,每个字符包含3个属性:
2016-05-25 21:15:15
604
原创 字符串的编辑距离
我们把字符串的相似度定义:将一个字符串转化为另一个字符串的时需要付出的代价。可以采用插入、删除、替换、三种方式编辑,代价就是编辑的次数。以SNOWY转化为SUNNY为例。 转换1:S-NOWY SUNN-Y转换的代价为3;(插入U,替换O,删除W);转换2:-SNOW-Y SUN--NY 代价为5(插入S,替换S,删除O,删除W
2016-05-19 20:14:01
259
原创 javascript中的的getYear()问题
getYear、getFullYear、getUTCFullYear都是Javascript的Date对象的方法函数。其中getYear()方法出生较早,在早期也一直使用OK,可是在2000年后这个方法问题多多,因为在Firefox和Safari等浏览器上,getYear始终返回年份与1900 年之间的差,比如1998年返回98,而2016年则会显示116,如果大家都这么处理也好,要加一起加,
2016-01-31 17:04:43
1237
原创 C#中的ComboBox用法
ComboBox 在C#中做窗体做下拉菜单是一个好的选择具体用法下:(1)创建一个ComboBoxItem类如下:public class ComboBoxItem { private string _text = null; private object _value = null; publ
2015-04-26 16:53:35
2970
原创 C#中的字符串总结
C#中的TextBox.text是string类型对单个字符操作是需要进行转换:char[]str=a.ToCharArray();//将字符串转换为字符数组string b = new string(str);//char数组转换成字符串b = a.ToUpper();//小写到大写b = a.ToLower();大写到小写
2015-04-19 19:18:38
284
原创 学习C#总结(一)
c#中windows的基本控件:1.Label:用于显示静态文本。2.TextBox:用于文本的输入。C#中的类型转换:1.获得控件中的文本并将其转换Double类型: r = Convert.ToDouble(textBox1.Text);2.将结果转换成文本并在控件中显示出来: textBox2.Text = Convert.ToString(c);3.获得控件中的文本
2015-04-18 14:17:56
824
原创 Let the Balloon Rise
Problem DescriptionContest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest i
2015-04-15 19:57:54
190
原创 humble numbers问题
Problem DescriptionA number whose only prime factors are 2,3,5 or 7 is called a humble number. The sequence 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12, 14, 15, 16, 18, 20, 21, 24, 25, 27, ... shows the first
2015-04-13 21:26:43
360
原创 max num问题
Problem DescriptionGiven 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 this sequence is 6 + (-1) + 5 +
2015-04-12 14:59:30
925
原创 ofstream和ifstream的用法
ofstream是从内存到硬盘,ifstream是从硬盘到内存中。一、打开文件 在fstream类中,有一个成员函数open(),就是用来打开文件的,其原型是: void open(const char* filename,int mode,int access 参数: filename: 要打开的文
2015-04-11 15:45:41
359
转载 a+b problem 大数相加
I have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B.The first line of the input contains an integer T(1<=T<=20) which means the number
2015-03-08 18:32:08
308
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人