自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 socket下的客户端与服务器对话

package com.qianfeng.socket2;import java.io.DataInputStream;import java.io.DataOutputStream;import java.io.IOException;import java.net.ServerSocket;import java.net.Socket;import java.util.Scann...

2019-01-10 19:49:16 179

原创 线程中的join,使另一线程优先运行

package com.qianfeng.join;public class TestJoin {    static Thread th2 = null;    public static void main(String[] args) {                Thread th1 = new Thread(new Runnable() {              ...

2019-01-10 17:40:18 178

原创 java多线程银行家算法

package com.qianfeng.bank;import java.util.concurrent.locks.ReentrantLock;public class Bank {    private int [] accounts = new int [100];    private Object object = new Object();    private Ree...

2019-01-10 17:25:05 456

原创 java内部类的调用

package com.qianfeng.memberinnerclass;public class Student {    public String stuName;    public int stuAge;    public class Course{        private String CourseName;        public void dosomet...

2019-01-09 19:59:32 130

原创 使用bufferedReader和bufferedWriter将文件内容复制到另一个文件中

package com.qianfeng.readerwriter;import java.io.BufferedReader;import java.io.BufferedWriter;import java.io.FileReader;import java.io.FileWriter;import java.io.IOException;public class TestRe...

2019-01-09 19:28:14 3046

原创 使用网络图片或者视频io接口保存到本地中

package com.qianfeng.download;import java.io.ByteArrayOutputStream;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.IOException;import java.io.InputStream;imp...

2019-01-09 17:41:36 247

转载 The Euler function(欧拉函数筛选)(转载)

http://blog.csdn.net/enjoying_science/article/details/41128577

2017-03-12 19:20:59 266

原创 BestCoder Round#92 1002 Count the Sheep

问题描述 开学翘课固然快乐,然而也有让呃喵抓狂的事,那当然就是考试了!这可急坏了既要翘课又想要打BC还要准备考试的呃喵。 呃喵为了准备考试没有时间刷题,想打BC又不想跌分,只得求助于BCround92的出题人snowy_smile,让他说点什么 >_<。 snowy_smile实在没有办法,但是又不好意思透题,只好告诉呃喵,当务之急是好好休息。 “如果你按照下面这个办法睡着,那么第二天就绝对

2017-03-01 20:29:26 268

转载 vector基本用法(转载)

转载于博客园 http://www.cnblogs.com/panjiangfy/archive/2012/05/30/vector.htmlvector是STL中最常见的容器,它是一种顺序容器,支持随机访问。 vector是一块连续分配的内存,从数据安排的角度来讲,和数组极其相似, 不同的地方就是:数组是静态分配空间,一旦分配了空间的大小,就不可再改变了; 而vector是动态分配空间,随着元素

2017-03-01 20:03:57 256

原创 Primes on Interval(素数打表+二分)

Description You’ve decided to carry out a survey in the theory of prime numbers. Let us remind you that a prime number is a positive integer that has exactly two distinct positive integer divisors.Con

2016-10-17 18:02:35 358

原创 HDU 1599:find the mincost route(floyd最短路成环)

Description 杭州有N个景区,景区之间有一些双向的路来连接,现在8600想找一条旅游路线,这个路线从A点出发并且最后回到A点,假设经过的路线为V1,V2,….VK,V1,那么必须满足K>2,就是说至除了出发点以外至少要经过2个其他不同的景区,而且不能重复经过同一个景区。现在8600需要你帮他找一条这样的路线,并且花费越少越好。 Input 第一行是2个整数N和M(N <= 100,

2016-08-18 15:50:02 326

原创 hdu5696 Gym Class

Description 众所周知,度度熊喜欢各类体育活动。 今天,它终于当上了梦寐以求的体育课老师。第一次课上,它发现一个有趣的事情。在上课之前,所有同学要排成一列, 假设最开始每个人有一个唯一的ID,从1到,在排好队之后,每个同学会找出包括自己在内的前方所有同学的最小ID,作为自己评价这堂课的分数。麻烦的是,有一些同学不希望某个(些)同学排在他(她)前面,在满足这个前提的情况下,新晋体育课老师—

2016-08-16 20:58:23 426

原创 HDU 1025:Constructing Roads In JGShining's Kingdom(LIS问题+二分)

Description JGShining’s kingdom consists of 2n(n is no more than 500,000) small cities which are located in two parallel lines. Half of these cities are rich in resource (we call them rich cities) whi

2016-08-11 16:16:04 310

原创 HDU 1059:Wooden Sticks(DP之LIS)

Description There is a pile of n wooden sticks. The length and weight of each stick are known in advance. The sticks are to be processed by a woodworking machine in one by one fashion. It needs some t

2016-08-11 16:04:50 201

原创 HDU 1087:Super Jumping! Jumping! Jumping!(DP之LIS)

Description Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and know little about this game, so I introduce it to you now. Th

2016-08-11 16:01:13 251

原创 hdu 2602 基础01背包

Problem Description Many years ago , in Teddy’s hometown there was a man who was called “Bone Collector”. This man like to collect varies of bones , such as dog’s , cow’s , also he went to the grave …

2016-08-09 21:09:19 225

原创 棋盘问题(经典DFS)

Description 在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。 Input 输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n <= 8 ,

2016-07-28 21:24:35 1151

原创 N皇后问题(经典DFS)

Description 在N*N的方格棋盘放置了N个皇后,使得它们不相互攻击(即任意2个皇后不允许处在同一排,同一列,也不允许处在与棋盘边框成45角的斜线上。 你的任务是,对于给定的N,求出有多少种合法的放置方法。 Input 共有若干行,每行一个正整数N≤10,表示棋盘和皇后的数量;如果N=0,表示结束。Output 共有若干行,每行一个正整数,表示对应输入行的皇后的不同放置数量。Sam

2016-07-28 21:22:44 474

原创 Tempter of the Bone(DFS+剪枝)

Description The 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 realized th

2016-07-28 21:15:40 181

原创 变形课(DFS)

Description 呃……变形课上Harry碰到了一点小麻烦,因为他并不像Hermione那样能够记住所有的咒语而随意的将一个棒球变成刺猬什么的,但是他发现了变形咒语的一个统一规律:如果咒语是以a开头b结尾的一个单词,那么它的作用就恰好是使A物体变成B物体. Harry已经将他所会的所有咒语都列成了一个表,他想让你帮忙计算一下他是否能完成老师的作业,将一个B(ball)变成一个M(Mous

2016-07-28 21:03:59 796

原创 Avoid The Lakes(DFS)

Description Farmer John’s farm was flooded in the most recent storm, a fact only aggravated by the information that his cows are deathly afraid of water. His insurance agency will only repay him, howe

2016-07-28 20:59:09 170

原创 Red and Black(基础DFS)

Description There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles.

2016-07-28 20:47:30 251

原创 排名(sort结构体)

Description 今天的上机考试虽然有实时的Ranklist,但上面的排名只是根据完成的题数排序,没有考虑 每题的分值,所以并不是最后的排名。给定录取分数线,请你写程序找出最后通过分数线的 考生,并将他们的成绩按降序打印。 Input 测试输入包含若干场考试的信息。每场考试信息的第1行给出考生人数N ( 0 < N < 1000 )、考题数M ( 0 < M < = 10 )、分数

2016-07-23 16:47:56 246

原创 1sting(大数递归)

Description You will be given a string which only contains ‘1’; You can merge two adjacent ‘1’ to be ‘2’, or leave the ‘1’ there. Surly, you may get many different results. For example, given 1111 , y

2016-07-23 16:40:34 506

原创 母牛的故事(递归+水)

Description 有一头母牛,它每年年初生一头小母牛。每头小母牛从第四个年头开始,每年年初也生一头小母牛。请编程实现在第n年的时候,共有多少头母牛?Input 输入数据由多个测试实例组成,每个测试实例占一行,包括一个整数n(0#include<stdio.h>int shu(int k){ int a[56]; a[1]=1; a[2]=2; a[3]=

2016-07-23 16:15:04 286

原创 A + B Problem II(大数基础加法)

Description I have a VERY SIMPLE problem for you. Given two integers A and B, your job is to calculate the Sum of A + B. 正整数高精度1000位加法 Input The first line of the input contains an integer T(1<=T<=

2016-07-23 15:58:16 282

原创 Big Number(大数取余)

Description As we know, Big Number is always troublesome. But it’s really important in our ACM. And today, your task is to write a program to calculate A mod B. To make the problem easier, I promise t

2016-07-23 15:45:57 2980

原创 18岁生日(闰年判断+水)

Description 当你还是18岁的时候,那个曾经一起追过的女孩刚好也是18岁,而且她的生日就要到了,你突然想到一个问题,是不是每个人到18岁生日所经过的天数都是一样的呢?我们来算一下吧 Input 首先输入一个整数n,表示有n组数据,格式是YYYY-MM-DD。 Output 对于每组数据输出一行,每行一个数,表示从出生到18岁生日所经过的天数。如果没有18岁生日,就输出-1。 S

2016-07-23 15:23:32 642

空空如也

空空如也

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

TA关注的人

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