自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Java —— 把对象传递给方法

首先创建了class Num的两个对象,将n1赋给n2。所以n1和n2有着相同的引用值,,它们都引用着同一对象。对于method1方法来说,将n1的·值传递给了形参num,与n2和n1的关系同理。。所以说在method1方法中对象num成员内容的任何改动,都会引起n1的内容改动。同时n1的变动也会引起n2的变动。而x传给y是值传递,所以y的变化则不会引起x的变化。对于method2

2017-02-28 22:38:43 3609

原创 The first Java programming of mine

/* * * Writer: Sunxin. * Date:2017.2.28. * Main:My first Java programming. * * 注:对以下程序操作时需要在src根目录下创建三个不同的类分别存放。 * * */// The class of Counterpublic class Counter { private int

2017-02-28 13:00:17 226

原创 蓝桥杯——最大的算式——DP

问题描述  题目很简单,给出N个数字,不改变它们的相对位置,在中间加入K个乘号和N-K-1个加号,(括号随便加)使最终结果尽量大。因为乘号和加号一共就是N-1个了,所以恰好每两个相邻数字之间都有一个符号。例如:  N=5,K=2,5个数字分别为1、2、3、4、5,可以加成:  1*2*(3+4+5)=24  1*(2+3)*(4+5)=45  (1*2+3)*(4+5)=4

2017-02-22 22:53:51 496

原创 蓝桥杯 —— 结点选择 —— 树状DP

思路:这是一道树状DP的题目。印尼为前几天做一道比较简单的树状DP的题目。那是一道codeforces

2017-02-21 20:33:10 524

原创 CodeForces - 148D Bag of mice 概率DP

The dragon and the princess are arguing about what to do on the New Year's Eve. The dragon suggests flying to the mountains to watch fairies dancing in the moonlight, while the princess thinks they sh

2017-02-18 17:43:44 289

原创 CodeForces - 274B Zero Tree — 树形DP

A tree is a graph with n vertices and exactly n - 1 edges; this graph should meet the following condition: there exists exactly one shortest (by number of edges) path between any pair of its vertice

2017-02-17 20:46:16 442

原创 蓝桥杯 裸最短路径

算法训练 最短路  时间限制:1.0s   内存限制:256.0MB      问题描述给定一个n个顶点,m条边的有向图(其中某些边权可能为负,但保证没有负环)。请你计算从1号点到其他点的最短路(顶点从1到n编号)。输入格式第一行两个整数n, m。接下来的m行,每行有三个整数u, v, l,表示u到v有一条长度为l的边。

2017-02-14 19:50:26 641

原创 CodeForces - 618C —— Constellation —— 几何

Cat Noku has obtained a map of the night sky. On this map, he found a constellation with n stars numbered from 1 to n. For each i, the i-th star is located at coordinates (xi, yi). No two stars are

2017-02-13 18:47:36 251

原创 9 * 9 数独游戏小程序 (DFS)

#include #include #include #include #include #include #include #include #include #include #include #include #define INF 0x3f3f3f3f#define mem(a,b) memset(a,b,sizeof(a));#define For(a,b)

2017-02-12 17:56:32 3127

原创 POJ - 3320 Jessica's Reading Problem (尺取)

Jessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on it. If she wants to pass it, she has to master all ideas incl

2017-02-10 23:16:43 217

原创 POJ - 3276 Face The Right Way (尺取)

Farmer John has arranged his N (1 ≤ N ≤ 5,000) cows in a row and many of them are facing forward, like good cows. Some of them are facing backward, though, and he needs them all to face forward to mak

2017-02-10 22:56:11 254

原创 POJ - 2686 ——Traveling by Stagecoach (状态压缩DP)

Traveling by Stagecoach POJ - 2686 这道题的意思是说给你n张票、m座城市、城市之间一共有p条道路、城市a和城市b给出n张票给出p条道路设T为从v到达u之间的时间。。T = d(v,u之间的距离) /  n_i (表示第i张票所代表的可以用几头马)求的是从a到达b之间最少的时间该题的思路是设

2017-02-10 20:05:55 270

原创 一些关于集合中位运算的操作

以下是一些位运算的操作首先一共有n个元素设定任意一个集合S一个集合T空集: ....... 0只含有第i个元素的集合: ....... 1<<i含有全部n个元素的集合: ........ (1 << n) - 1判断第i个元素是否属于集合S: ..... if( S >> i & 1 )向集合中加入第i个元素:

2017-02-09 23:15:26 452

原创 旅行商问题 —— 状态压缩DP

如果说在给定的数据类型范围内,事件的规模已经达到了  (n!)   。即使这个时候n特别小,仍然不能够都试一遍,所以需要用DP来解决。再就是在记忆化搜索的过程中,DP的一个下标并不是整数,但是我们可以将其编码成一个整数。对于集合可以把元素的选取与否对应到一个二进制位里面,从而把状态压缩成一个整数,大大方便了计算和维护。 针对集合的DP叫做状态压缩DP。#include #incl

2017-02-09 23:11:45 617

空空如也

空空如也

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

TA关注的人

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