类 class 关键字提供了一种包含机制,将数据和操作数据的方法结合到一起,作为内置类型来使用. 类可以包含私有部分,仅其成员和 friend 类访问,公有部分可以在程序中任意位置处访问. 构造函数与类重名.析构函数用来定义对象销毁时操作. class pt2d { // class for 2D points private: // private members double x; // x coordinate double y; // y coordinate public: // pu…
本文参考自<C++ and Object-Oriented Numeric Computing for Scientists and Engineers>. 1. Basic Types 在 C++ 中,变量的声明不必像 C 和 Fortran 一样放在程序最前方,可以在变量使用前声明,增加程序可读性. C++ 中有布尔类型变量,关键字为 bool. C++ 中标准库内 numeric_limits 模板函数可以返回不同类型变量的最大值与最小值. C++ 内标示符要求由字符.数字与下划线组成,…
背景 本学期在北京大学选修了<数据库概论>的实验班课程,由于 SQL 语法并不是特别理论的内容,因此课上暂时也没有特别展开.出于探索数据库领域的兴趣,使用国内普遍使用的数据库软件 MySQL 实践<数据库系统概念>中若干 SQL 语句主题:出于方便描述考虑,主要使用命令行界面操作. MySQL 的安装 在 Mac OS X 下使用 brew install mysql 简单的安装 MySQL,其他的安装方式不作介绍. 大学模式的导入 首先打开 MySQL 的 Server 服务.…
Building a Space Station Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 5173 Accepted: 2614 Description You are a member of the space station engineering team, and are assigned a task in the construction process of the station. You ar…
畅通工程再续 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 17913 Accepted Submission(s): 5593 Problem Description 相信大家都听说一个“百岛湖”的地方吧,百岛湖的居民生活在不同的小岛中,当他们想去其他的小岛时都要通过划小船来实现.现在政府决定大力发展百岛湖,发展首先要解决的问题…
还是畅通工程 Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 30542 Accepted Submission(s): 13670 Problem Description 某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离.省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能…
The Unique MST Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22668 Accepted: 8038 Description Given a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undire…
Highways Time Limit:1000MS Memory Limit:10000KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 1751 Appoint description: System Crawler (2015-06-02) Description The island nation of Flatopia is perfectly flat. Unfortunately, Flato…
Arctic Network Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2349 Appoint description: System Crawler (2015-06-01) Description The Department of National Defence (DND) wishes to connect seve…
Constructing Roads Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 2421 Appoint description: System Crawler (2015-05-27) Description There are N villages, which are numbered from 1 to N, and y…
连接的管道 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 653 Accepted Submission(s): 268 Problem Description 老 Jack 有一片农田,以往几年都是靠天吃饭的.但是今年老天格外的不开眼,大旱.所以老 Jack 决定用管道将他的所有相邻的农田全部都串联起来,这样他就可以从远处引水过…
Gautam and Subhash are two brothers. They are similar to each other in all respects except one. They have different ways of searching. When Gautam has to search for an item from a lot, he goes through all the items one by one and stops when he finds…