上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页
摘要: 1 #include 2 #include 3 using namespace std; 4 5 /*计算一个整数的二进制中1的个数*/ 6 int NumberOf1( int n) { 7 int count = 0; 8 9 while (n) {10 11 ... 阅读全文
posted @ 2014-06-05 14:36 soul390 阅读(187) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 using namespace std; 4 5 6 int RandomInRange(int start, int end) { 7 srand((unsigned)time(NULL)); 8 int value = ran... 阅读全文
posted @ 2014-06-05 11:33 soul390 阅读(709) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 4 void replace(char ch[]) { 5 int count = 0; 6 int len = 0; 7 char *p = ch; 8 while(*p != '\0') ... 阅读全文
posted @ 2014-06-05 09:02 soul390 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 #include 3 using namespace std; 4 int main() { 5 string s("HelloWorld"); 6 // 下面的两个地址是不一样的,但是地址的内容是一样的 7 string* ch = &s; 8 ... 阅读全文
posted @ 2014-06-03 15:56 soul390 阅读(190) 评论(0) 推荐(0) 编辑
摘要: 1 #include 2 using namespace std; 3 int main() 4 { 5 //制表符是8个字符,当在一个制表符开始的位置(明白什么位置是制表符开始的位置)输出一个字符串时, 6 //如果字符串不到8个字符,加一个"\t",会补充空格,达到一个制表符 ... 阅读全文
posted @ 2014-06-02 16:27 soul390 阅读(8738) 评论(0) 推荐(0) 编辑
摘要: 题目:A Pythagorean triplet is a set of three natural numbers, a b c, for which,a2 + b2 = c2For example, 32 + 42 = 9 + 16 = 25 = 52.There exists exactl... 阅读全文
posted @ 2014-05-30 22:01 soul390 阅读(129) 评论(0) 推荐(0) 编辑
摘要: 题目:The four adjacent digits in the 1000-digit number that have the greatest product are 9 9 8 9 = 5832. 7316717653133062491922511967442657474235534... 阅读全文
posted @ 2014-05-30 21:24 soul390 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 题目:By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.What is the 10 001st prime number?方法一: 1 #inclu... 阅读全文
posted @ 2014-05-25 20:47 soul390 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 题目:The sum of the squares of the first ten natural numbers is,12 + 22 + ... + 102 = 385The square of the sum of the first ten natural numbers is,(1 + ... 阅读全文
posted @ 2014-05-24 11:38 soul390 阅读(125) 评论(0) 推荐(0) 编辑
摘要: 题目:2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest positive number that... 阅读全文
posted @ 2014-05-24 11:21 soul390 阅读(110) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 10 11 ··· 19 下一页