- 博客(70)
- 收藏
- 关注
原创 杭电1213_How Many Tables——java(并查集)
Problem DescriptionToday is Ignatius' birthday. He invites a lot of friends. Now it's dinner time. Ignatius wants to know how many tables he needs at least. You have to notice that not all the friends...
2018-03-01 14:26:10
416
转载 一位资深程序员大牛给予Java初学者的学习路线建议
如果你是在校学生,务必要在学好基础(比如计算机系统、算法、编译原理等等)的前提下,再考虑去进行下面的学习。第一部分:对于尚未做过Java工作的同学,包括一些在校生以及刚准备转行Java的同学。 一、Java基础首先去找一个Java的基础教程学一下,这里可以推荐一个地址,或者你也可以参照这个地址上去找相应的视频。学习Java基础的时候,应该尽量多动手,很多时候,你想当然的事情,等你写出来运行一下...
2018-02-28 10:11:54
1123
原创 归并排序——java
import java.io.BufferedInputStream;import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner sc = new Scanner(new BufferedInputStream(System.in)); ...
2018-02-25 17:22:58
179
原创 SQL中exists和in的一些区别
1.exist,not exist一般都是与子查询一起使用. In可以与子查询一起使用,也可以直接in (a,b.....)。2.exist会针对子查询的表使用索引. not exist会对主子查询都会使用索引. in与子查询一起使用的时候,只能针对主查询使用索引. not in则不会使用任何索引. 注意,一直以来认为exists比in效率高的说法是不准确的。3.in 是把外表和内表作hash 连...
2018-02-25 11:22:08
2762
原创 二进制的原码、反码和补码
一. 机器数和真值在学习原码, 反码和补码之前, 需要先了解机器数和真值的概念.1、机器数一个数在计算机中的二进制表示形式, 叫做这个数的机器数。机器数是带符号的,在计算机用一个数的最高位存放符号, 正数为0, 负数为1.比如,十进制中的数 +3 ,计算机字长为8位,转换成二进制就是00000011。如果是 -3 ,就是 10000011 。那么,这里的 00000011 和 10000011 ...
2018-02-25 09:31:21
2344
3
原创 杭电1107_武林——java
Problem Description在一个有12行12列的方形的武林世界里,少林、武当和峨嵋三派的弟子们在为独霸武林而互相厮杀。武林世界的第一行的一列格子的坐标是(1, 1),第一行第二列坐标是(1, 2)……右下角的坐标为(12, 12)。如图:少林派弟子总是在同一列回不停地行走。先往下走,走到头不能再走时就往上走,再到头则又往下走……比如,(1, 1) -> (2, 1) -> ...
2018-02-09 21:23:11
601
原创 杭电2553_N皇后(直接DFS解法和二进制状态压缩解法)——java
Problem Description在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。 Output共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。 S...
2018-02-09 21:08:10
494
原创 杭电1027_Ignatius and the Princess II ——java
Problem DescriptionNow our hero finds the door to the BEelzebub feng5166. He opens the door and finds feng5166 is about to kill our pretty Princess. But now the BEelzebub has to beat our hero first. f...
2018-02-09 13:57:32
250
原创 Dijkstra算法——java实现
import com.sun.javafx.image.IntPixelGetter;import java.util.*;public class Main { public static long count = 0; public static void main(String[] args) { Scanner sc = new Scanner(S...
2018-02-09 13:41:41
749
1
原创 杭电1026_ Ignatius and the Princess I (BFS+模拟 或者 BFS+优先队列)——java
Problem DescriptionThe Princess has been abducted by the BEelzebub feng5166, our hero Ignatius has to rescue our pretty Princess. Now he gets into feng5166's castle. The castle is a large labyrinth. T...
2018-02-08 14:49:31
430
原创 杭电2501_Tiling_easy version——java
Problem Description有一个大小是 2 x n 的网格,现在需要用2种规格的骨牌铺满,骨牌规格分别是 2 x 1 和 2 x 2,请计算一共有多少种铺设的方法。 Input输入的第一行包含一个正整数T(T<=20),表示一共有 T组数据,接着是T行数据,每行包含一个正整数N(N<=30),表示网格的大小是2行N列。 Output输出一共有多少种铺设的方法,每组数据的输出...
2018-02-08 14:29:49
370
转载 最短路径问题---Dijkstra算法详解
1、最短路径问题介绍问题解释: 从图中的某个顶点出发到达另外一个顶点的所经过的边的权重和最小的一条路径,称为最短路径解决问题的算法:迪杰斯特拉算法(Dijkstra算法)弗洛伊德算法(Floyd算法)SPFA算法这篇博客,我们就对Dijkstra算法来做一个详细的介绍2、Dijkstra算法介绍算法特点:迪科斯彻算法使用了广度优先搜索解决赋权有向图或者无向图...
2018-02-08 09:59:15
896
原创 杭电2566_统计硬币——java
Problem Description假设一堆由1分、2分、5分组成的n个硬币总面值为m分,求一共有多少种可能的组合方式(某种面值的硬币可以数量可以为0)。 Input输入数据第一行有一个正整数T,表示有T组测试数据;接下来的T行,每行有两个数n,m,n和m的含义同上。 Output对于每组测试数据,请输出可能的组合方式数;每组输出占一行。 Sample Input23 54 8 Sample O...
2018-02-07 22:58:10
774
原创 linux-打包与解压命令
在linux系统中,有以下比较常用的压缩格式:.zip、.gz、.bz2、.tar.gz、.tar.bz2。 1、zip:这种格式在linux和windows是可以通用的。打包格式为:(zip 压缩文件名 源文件)、(zip -r 压缩文件名 源目录)。zip的压缩会保留源文件。解压格式为:unzip 压缩文件。解压也会保留原来的压缩文件。2、gzip:打包格式为:(gzip 源文件) ,此方法...
2018-02-07 22:37:05
538
原创 杭电1012_u Calculate e
Problem DescriptionA simple mathematical formula for e iswhere n is allowed to go to infinity. This can actually yield very accurate approximations of e using relatively small values of n.
2018-02-06 22:58:58
282
原创 杭电1010_Tempter of the Bone——java
Problem DescriptionThe doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He real...
2018-02-06 22:52:51
644
原创 杭电1009_FatMouse' Trade——java
Problem DescriptionFatMouse prepared M pounds of cat food, ready to trade with the cats guarding the warehouse containing his favorite food, JavaBean.The warehouse has N rooms. The i-th room contains ...
2018-02-06 22:23:35
664
原创 杭电1008_Elevator
Problem DescriptionThe 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 specifie
2018-02-06 22:20:45
187
原创 杭电1005_Number Sequence
Problem DescriptionA number sequence is defined as follows:f(1) = 1, f(2) = 1, f(n) = (A * f(n - 1) + B * f(n - 2)) mod 7.Given A, B, and n, you are to calculate the value of f(n).
2018-02-06 22:18:41
252
原创 杭电1004_Let the Balloon Rise
Problem DescriptionContest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest
2018-02-06 22:17:26
235
原创 杭电1003_Max Sum
Problem DescriptionGiven a sequence a[1],a[2],a[3]......a[n], your job is to calculate the max sum of a sub-sequence. For example, given (6,-1,5,4,-7), the max sum in this sequence is 6 + (-1) + 5
2018-02-06 22:13:17
281
原创 杭电1002_A + B Problem II
Problem DescriptionI have a very simple problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. InputThe first line of the input contains an integer T(1<=T<=20) which
2018-02-06 22:09:35
217
原创 杭电1001_Sum Problem
Problem DescriptionHey, welcome to HDOJ(Hangzhou Dianzi University Online Judge).In this problem, your task is to calculate SUM(n) = 1 + 2 + 3 + ... + n. InputThe input will consist of a series of
2018-02-06 22:03:32
311
原创 杭电1000_A + B Problem
Problem DescriptionCalculate A + B. InputEach line will contain two integers A and B. Process to end of file. OutputFor each case, output A + B in one line.
2018-02-06 21:58:59
251
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅