自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

原创 CoreJava Volume 1 Chapter 5 - Inheritance

Classes, Superclasses, and Subclasses Defining Subclasses public class Manager extends Employee { added methods and fields } The kewyord extends indicates that you are makingn a new class taht derives from an existing class. The existing class

2020-06-16 07:13:00 537

原创 CoreJava - Chapter 4: Objects and Classes

Introduction to Object-Oritented Programming Introduction Each object has a specific functionality, exposed to its users, and a hidden implementation Basically, as long as an object satisfies your specifications, you don't care how the functionality is

2020-06-14 01:28:20 1000

原创 Beginning Linux Programming - Chapter 1: Getting Started

Unix, Linux, and GNU Unix The UNIX operating system was originally developed at Bell Laboratories, once part of the telecommunication giant AT&T History Unix is a trademark administered by The Open Group, and it refers to a computer operating sys

2020-06-09 05:47:06 415

原创 CoreJava - Chapter 3: Fundamental Programming Structures in Java

3.1 A Simple Java Program public class FirstSample { public static void main(String[] args) { System.out.println("We will not use 'Hello, World!'"); } } The keyword public is called an access modifier; these modifiers control the lev

2020-06-08 22:26:24 489

原创 CoreJava - Chapter 2: The java Programming Environment

2.1 Installing he Java Development Kit Java Jargons Java Development Kit (JDK): The software for programmers who want to write Java programs Java Runtime Environment (JRE): The software for consumers who wnat to run Java programs Server (JRE): The so

2020-06-04 19:59:43 233

原创 CoreJava - Chapter 1: Introduction to Java

1.1 Java as a Programming Platform Java isnot only a programming language, but also a platform 1.2 The Java "White Paper" Buzzwords Simple Compared to C++ Small: 40k for the size of the basic interpreter and class support; 175k for the basic standar..

2020-06-04 11:01:24 451

原创 Uva 11450 Wedding Shopping

题目链接:https://uva.onlinejudge.org/external/114/11450.pdf 分析:此题与01背包问题有些相似,因为能买的东西的最大价格取决于限购额M和要买东西的种类,可以用dp[i][j]来代表在购买种类为j的情况下,可不可能剩下i数量的钱数。如果dp[k][n] () 为true的话,则最终答案为 max(M - k)。反之,若dp[k][n]都是false...

2018-12-22 13:40:50 334

原创 Uva 437 Tower of Babylon

题目链接:https://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&category=24&page=show_problem&problem=378 分析:运用Directed Acyclic Graph Model,枚举每一个正方体的两个面,把每一个由此得到的正方形当作一个结点,...

2018-12-22 12:41:52 279

原创 Molekule Croatian Open Competition Informatics 2015 2016 Contest 3

题目链接:https://open.kattis.com/problems/molekule 题目大意:一共有N个结点,给N - 1条有向边,使得这N的结点全部连通(Tree)。你的任务是决定每条边的方向(u -> v or v -> u)使得所有边中最长边的长度最短。 思路:因为给的图是Tree,所以最长边的最短长度是1。用BFS给图中的结点染色(假如结点u的颜色为0,所有edg...

2018-11-28 14:54:54 347

原创 Uva 12661 Funny Car Racing

分析:因为有单个源点和终点,每条有向道路上都有对应的开销,可以联想到单源最短路算法。而与常见的单源最短路算法的区别则是在松弛操作中对距离的处理上,有两种情况:        1. 当我们到某条道路e上,当前时间和通过e的时间允许我们直接通过e        2. 当我们到某条道路e上,当前时间和通过e的时间不允许我们直接通过e,则我们需要等待curTime % (e.a + e.b)  ...

2018-11-27 14:57:06 302

原创 H Vin Diagram ICPC East Central NA 2016

题目链接:https://open.kattis.com/contests/ecva3o/problems/vindiagrams Description:  Problem H Vin Diagrams Venn diagrams were invented by the great logician John Venn as a way of categorizing elements ...

2018-11-02 11:08:33 568

原创 10/28/2018 Minimal Coin Problems (最小硬币问题)

                                                                              Minimal Coin Problem(DP) Problem Statement:  Given an amount of money n, (n >= 1) and a list of coins (the number of ...

2018-10-29 10:24:52 287

原创 10/21/2018 Bellman-Ford 算法

Background: 当负权存在时,最短路不一定存在。如果最短路存在,一定存在一个不含环的最短路。 理由如下:在边权可正可负的图中,环有零环、正环和负环三种。如果包含零环或正环,去掉以后路径不会变长;如果包含负环,则意味着最短路不存在。(路径可以一直在负环中循环,则权值会无限小) 既然不含环,则最短路最多只经过(不算起点)个结点,可以通过 轮松弛操作得到。代码如下(起点为0): for...

2018-10-28 13:00:29 244

原创 10/16/2018 欧拉回路

Introduction:  七桥问题: 有一条名为Pregel的河流经过Konigsberg城。城中有7座桥,把河中的两个岛与河岸连接起来。当地居民热衷于一个难题:是否存在一条路线,可以不重复地走遍7座桥。该问题由欧拉首先提出。 问题的核心:能否从无向图的一个结点出发走出一条道路,每条边恰好经过一次 -> 欧拉道路 欧拉道路:如果一个图只是一个形成一个连通连通所有节点的链,且每...

2018-10-21 23:39:31 392

原创 10/21 Kruskal算法

Background:     在无向图中,连通并且不含圈的图称为树(Tree)。给定无向图G = (V, E), 连接G中所有点,且边集是E的子集的树的生成树称为G的(Spanning Tree),而权值最小的生成树称为最小生成树(Minimal Spanning Tree, MST)。Kruscal算法就是构造最小生成树的一种算法。 Kruskal Algorithm: Steps:  ...

2018-10-21 23:34:44 326

原创 10/19/2018 Dijkstra's shortest path algorithm

Dijkstra's shortest path algorithm:    Dijkstra's algorithm is very similar to Prim's algorithm for minimum spanning tree. Like Prim's MST, we generate a SPT (shortest path tree) with a given source ...

2018-10-21 22:12:56 841

原创 10/18/2018 快速幂和矩阵快速幂

快速幂: 通常来说,假如让我们计算x^n的值的时候,我们会想到x * x * x * .... * x,这种方法的效率是O(n)。但是有更高效的方法: 1. 如果当前的指数是偶数,我们就把指数拆成两半,得到两个相同的数,然后把这两个相同的数相乘,可以得到原来的数。 2. 如果当前的指数是奇数,我们把当前的指数拆成两半(floor(n / 2)),得到两个相同的数,然后把这两个数相乘之...

2018-10-19 13:54:37 291

原创 10/16/2018 GNY Region 2015 ACM Regional Running Steps

Problem H Running Steps The coach wants his team members to run up the stadium steps taking either one or two steps with each stride so that: The number of two step strides taken by each leg is th...

2018-10-19 06:06:43 324

原创 10/16/2018 Topological Sort (Directed Acyclic Graph)

Topological Sort: Topological sort of a Directed Acyclic Graph (DAG) is a linear ordering of the vertices in the DAG so that vertex u comes before vertex v if the edge (u -> v) exists in the DAG. E...

2018-10-17 06:24:26 764

原创 10/13/2018 BFS

BFS (Breadth First Search) Starting from a distinguished source vertex, BFS will traverse the graph 'breadth first'. That is, BFS will visit vertices that are direct neighbors of the source vertex (f...

2018-10-14 21:00:31 267

原创 10/13/2018 DFS

DFS(Depth First Search):A simple algorithm for traversing a graph. Features: Starting from a distinguished source vertex, DFS will traverse the graph-first'. Everytime DFS hits a branching point(a ve...

2018-10-13 15:10:53 260

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除