
C++
文章平均质量分 69
littledou2015
真正了不起的程序员对自己程序的每一个字节都了如指掌。
展开
-
1007. Maximum Subsequence Sum (25)
Given a sequence of K integers { N1, N2, ..., NK }. A continuous subsequence is defined to be { Ni, Ni+1, ..., Nj} where 1 Maximum Subsequence is the continuous subsequence which has the largest sum原创 2014-11-10 10:33:27 · 389 阅读 · 0 评论 -
1019. General Palindromic Number (20)
A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers原创 2014-11-20 17:50:07 · 327 阅读 · 0 评论 -
1016. Phone Bills (25)
A long-distance telephone company charges its customers by the following rules:Making a long-distance call costs a certain amount per minute, depending on the time of day when the call is made. Wh原创 2014-11-20 10:41:02 · 418 阅读 · 0 评论 -
1018. Public Bike Management (30)
There is a public bike service in Hangzhou City which provides great convenience to the tourists from all over the world. One may rent a bike at any station and return it to any other stations in the原创 2014-11-20 16:53:19 · 344 阅读 · 0 评论 -
1020. Tree Traversals (25)
Suppose that all the keys in a binary tree are distinct positive integers. Given the postorder and inorder traversal sequences, you are supposed to output the level order traversal sequence of the cor原创 2014-11-20 17:50:52 · 463 阅读 · 0 评论 -
1021. Deepest Root (25)
A graph which is connected and acyclic can be considered a tree. The height of the tree depends on the selected root. Now you are supposed to find the root that results in a highest tree. Such a root原创 2014-11-20 18:00:19 · 312 阅读 · 0 评论 -
1022. Digital Library (30)
A Digital Library contains millions of books, stored according to their titles, authors, key words of their abstracts, publishers, and published years. Each book is assigned an unique 7-digit number a原创 2014-11-23 15:51:24 · 381 阅读 · 0 评论 -
1027. Colors in Mars (20)
People in Mars represent the colors in their computers in a similar way as the Earth people. That is, a color is represented by a 6-digit number, where the first 2 digits are for Red, the middle 2 dig原创 2014-11-26 23:10:36 · 352 阅读 · 0 评论 -
1033. To Fill or Not to Fill (25)
With highways available, driving a car from Hangzhou to any other city is easy. But since the tank capacity of a car is limited, we have to find gas stations on the way from time to time. Different ga原创 2014-11-27 19:40:09 · 369 阅读 · 0 评论 -
1023. Have Fun with Numbers (20)
Notice that the number 123456789 is a 9-digit number consisting exactly the numbers from 1 to 9, with no duplication. Double it we will obtain 246913578, which happens to be another 9-digit number con原创 2014-11-23 16:03:40 · 430 阅读 · 0 评论 -
1034. Head of a Gang (30)
One way that the police finds the head of a gang is to check people's phone calls. If there is a phone call between A and B, we say that A and B is related. The weight of a relation is defined to be t原创 2014-11-27 23:00:18 · 380 阅读 · 0 评论 -
1026. Table Tennis (30)
A table tennis club has N tables available to the public. The tables are numbered from 1 to N. For any pair of players, if there are some tables open when they arrive, they will be assigned to the ava原创 2014-11-26 22:49:40 · 378 阅读 · 0 评论 -
1025. PAT Ranking (25)
Programming Ability Test (PAT) is organized by the College of Computer Science and Technology of Zhejiang University. Each test is supposed to run simultaneously in several places, and the ranklists w原创 2014-11-24 15:41:14 · 417 阅读 · 0 评论 -
1024. Palindromic Number (25)
A number that will be the same when it is written forwards or backwards is known as a Palindromic Number. For example, 1234321 is a palindromic number. All single digit numbers are palindromic numbers原创 2014-11-24 14:09:13 · 350 阅读 · 0 评论 -
1010. Radix (25)
Given a pair of positive integers, for example, 6 and 110, can this equation 6 = 110 be true? The answer is "yes", if 6 is a decimal number and 110 is a binary number.Now for any pair of positive原创 2014-11-10 18:45:29 · 426 阅读 · 0 评论 -
C语言中声明和定义的区别——分析extern关键词。
一直很迷惑C语言中的声明和定义的有些实践中的用法,说迷惑实践是因为声明和定义的概念上的区别是很明确的。定义和声明的区别(主要针对变量):定义是要为变量分配存储空间,还可以在定义的时候为变量指定初始值。在一个程序中,变量有且仅有一次定义。声明用于向程序表明变量的类型和名字。定义包括声明:定义变量时我们声明了变量的类型和名字。可以使用extern关键字声明变量名而定义它。不定义变量的声明包原创 2015-06-03 08:28:00 · 4632 阅读 · 0 评论 -
1017. Queueing at Bank (25)
Suppose a bank has K windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. All the customers have to wait in line behind the yellow li原创 2014-11-20 14:32:16 · 440 阅读 · 0 评论 -
1014. Waiting in Line (30)
Suppose a bank has N windows open for service. There is a yellow line in front of the windows which devides the waiting area into two parts. The rules for the customers to wait in line are:The s原创 2014-11-13 22:03:53 · 361 阅读 · 0 评论 -
1004. Counting Leaves (30)
A family hierarchy is usually presented by a pedigree tree. Your job is to count those family members who have no child.InputEach input file contains one test case. Each case starts with原创 2014-11-09 22:36:52 · 346 阅读 · 0 评论 -
1006. Sign In and Sign Out (25)
At the beginning of every day, the first person who signs in the computer room will unlock the door, and the last one who signs out will lock the door. Given the records of signing in's and out's, you原创 2014-11-09 23:17:59 · 322 阅读 · 0 评论 -
1005. Spell It Right (20)
Given a non-negative integer N, your task is to compute the sum of all the digits of N, and output every digit of the sum in English.Input Specification:Each input file contains one test case.原创 2014-11-09 22:47:58 · 375 阅读 · 0 评论 -
1008. Elevator (20)
The highest building in our city has only one elevator. A request list is made up with N positive numbers. The numbers denote at which floors the elevator will stop, in specified order. It costs 6 sec原创 2014-11-10 14:37:00 · 366 阅读 · 0 评论 -
1011. World Cup Betting (20)
With the 2010 FIFA World Cup running, football fans the world over were becoming increasingly excited as the best players from the best teams doing battles for the World Cup trophy in South Africa. Si原创 2014-11-10 19:05:56 · 348 阅读 · 0 评论 -
1009. Product of Polynomials (25)
This time, you are supposed to find A*B where A and B are two polynomials.Input Specification:Each input file contains one test case. Each case occupies 2 lines, and each line contains the inf原创 2014-11-10 15:00:56 · 395 阅读 · 0 评论 -
1012. The Best Rank (25)
To evaluate the performance of our first year CS majored students, we consider their grades of three courses only: C - C Programming Language, M - Mathematics (Calculus or Linear Algebra), and E - Eng原创 2014-11-11 14:06:33 · 358 阅读 · 0 评论 -
1013. Battle Over Cities (25)
It is vitally important to have all the cities connected by highways in a war. If a city is occupied by the enemy, all the highways from/toward that city are closed. We must know immediately if we nee原创 2014-11-11 15:55:39 · 382 阅读 · 0 评论 -
1015. Reversible Primes (20)
A reversible prime in any number system is a prime whose "reverse" in that number system is also a prime. For example in the decimal system 73 is a reversible prime because its reverse 37 is also a pr原创 2014-11-13 22:34:35 · 362 阅读 · 0 评论 -
命令空间using的声明
std标准库作用域操作符::hany原创 2014-10-15 20:07:21 · 483 阅读 · 0 评论 -
C++变量 声明、初始化、定义
1、命名空间的using声明2、标准库类型string3、标准k原创 2014-10-14 21:03:05 · 3263 阅读 · 0 评论 -
const限定符
const对变量类型加以限定,一定对象创建,其值不能在原创 2014-10-14 22:00:04 · 313 阅读 · 0 评论 -
复合类型
复合类型是基于其他类型d原创 2014-10-14 21:16:27 · 508 阅读 · 0 评论 -
智能指针的实现
智能指针能防止内存泄漏和非法指针引用。根据C++Primer和MSDN中关于shared_ptr的接口,实现了只有重要函数的简化版的shared_ptr#include #include using namespace std;template class shared_ptr;template class u_Counter;templateclass shared_ptr原创 2015-09-07 22:15:29 · 660 阅读 · 0 评论