摘要: 直接使用/etc/mysql/debian.cnf文件中[client]节提供的用户名和密码:# mysql -udebian-sys-maint -pEnter password: mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;mysql> FLUSH PRIVILEGES;mysql> quit# mysql -uroot -pEnter password: mysql> 阅读全文
posted @ 2013-10-07 16:45 黄牛 阅读(509) 评论(0) 推荐(0) 编辑
摘要: Names scoresProblem 2219 July 2002Usingnames.txt(right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical p 阅读全文
posted @ 2012-12-27 18:09 黄牛 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Amicable numbersProblem 2105 July 2002Let d(n) be defined as the sum of proper divisors ofn(numbers less thannwhich divide evenly inton).If d(a) =band d(b) =a, whereab, thenaandbare an amicable pair and each ofaandbare called amicable numbers.For example, the proper divisors of 220 are 1, 2, 4, 5, 1 阅读全文
posted @ 2012-12-26 10:43 黄牛 阅读(99) 评论(0) 推荐(0) 编辑
摘要: Counting SundaysProblem 1914 June 2002You are given the following information, but you may prefer to do some research for yourself.1 Jan 1900 was a Monday.Thirty days has September,April, June and November.All the rest have thirty-one,Saving February alone,Which has twenty-eight, rain or shine.And o 阅读全文
posted @ 2012-12-20 15:24 黄牛 阅读(159) 评论(0) 推荐(0) 编辑
摘要: http://projecteuler.net/problem=18Maximum path sum IProblem 1831 May 2002By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23.3742468 593That is, 3 + 7 + 4 + 9 = 23.Find the maximum total from top to bottom of the tr 阅读全文
posted @ 2012-12-19 20:26 黄牛 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 将程序日志中的树状结构的报文,转换为XML格式的报文。输入样式为 1 ├─0.COMMON_INFO(utype) 2 │ ├─0.PROVINCE_GROUP(string):10017 3 │ ├─1.SESSION_ID(string):Dj32QgQQlzjD2MFRn1JKcLlffXL6xfFRKn313Bnyr8SwfGV12dQS!903836304!1348468960414 4 │ ├─2.SER_NAME(string): 5 │ ├─3.ROUND_AUDIT(string):Y 6 │ ├─4.DEST_IP(string):172.21.0.123 7 │... 阅读全文
posted @ 2012-12-05 17:41 黄牛 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Problem 2021 June 2002n! meansn(n1)...321For example, 10! = 109...321 = 3628800,and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27.Find the sum of the digits in the number 100!Answer:648这个题,复用的第16题写的大数字类BigNum的运算。void p20(){ BigNum bn(1); BigNum ab=bn; BigNum tt; ... 阅读全文
posted @ 2012-12-05 17:33 黄牛 阅读(101) 评论(0) 推荐(0) 编辑
摘要: Problem 1603 May 2002215= 32768 and the sum of its digits is 3 + 2 + 7 + 6 + 8 = 26.What is the sum of the digits of the number 21000?Answer:1366C++貌似没有现成的对超大数字的支持,我写了个用来计算超大数字的类。为了简单,没有动态分配数组长度。//设置长数字的最大容量const int MAX_LENGTH = 1000;//计算数字的位数int GetDigitCount(int n){ int c = 0 ; while (n) ... 阅读全文
posted @ 2012-12-05 17:31 黄牛 阅读(132) 评论(0) 推荐(0) 编辑
摘要: http://projecteuler.net/problem=15Starting in the top left corner of a 22 grid, there are 6 routes (without backtracking) to the bottom right corner.How many routes are there through a 2020 grid?做出来一个时间复杂度超高的程序: 1 const int MAX_ROW=20; 2 const int MAX_COLUMN=20; 3 long long path=0; 4 void tree(int i 阅读全文
posted @ 2012-11-23 16:57 黄牛 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 1 #include"pub.h" 2 #include <map> 3 4 long cnt=0; 5 map<long,long> mp; 6 long collatz(long n) 7 { 8 if(mp.find(n)!=mp.end()) 9 return mp[n];10 else11 {12 if(n<=1)13 {14 return 1;15 }16 else17 {18 if(n&1)19 ... 阅读全文
posted @ 2012-11-19 16:19 黄牛 阅读(198) 评论(0) 推荐(0) 编辑