自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 Moving Tables(杭电1050)(贪心---区间不重叠问题)

Moving TablesTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 25967    Accepted Submission(s): 8608Problem DescriptionThe famous

2015-12-31 23:58:02 448

原创 阶乘之和(南阳oj91)(水题)

阶乘之和时间限制:3000 ms  |  内存限制:65535 KB难度:3描述给你一个非负数整数n,判断n是不是一些数(这些数不允许重复使用,且为正数)的阶乘之和,如9=1!+2!+3!,如果是,则输出Yes,否则输出No;输入第一行有一个整数0每组测试数据有一个正整数n输出如果符合条件,输出Yes,否则输出No;样例输入2910样例输出YesNo

2015-12-31 19:02:20 692

原创 独木舟上的旅行(南阳oj71)(贪心)

独木舟上的旅行时间限制:3000 ms  |  内存限制:65535 KB难度:2描述 进行一次独木舟的旅行活动,独木舟可以在港口租到,并且之间没有区别。一条独木舟最多只能乘坐两个人,且乘客的总重量不能超过独木舟的最大承载量。我们要尽量减少这次活动中的花销,所以要找出可以安置所有旅客的最少的独木舟条数。现在请写一个程序,读入独木舟的最大承载量、旅客数目和每位旅客的重量。根据

2015-12-31 15:42:12 447

原创 喷水装置(二)(南阳oj12)(贪心之区间覆盖问题)

喷水装置(二)时间限制:3000 ms  |  内存限制:65535 KB难度:4描述有一块草坪,横向长w,纵向长为h,在它的橫向中心线上不同位置处装有n(n<=10000)个点状的喷水装置,每个喷水装置i喷水的效果是让以它为中心半径为Ri的圆都被润湿。请在给出的喷水装置中选择尽量少的喷水装置,把整个草坪全部润湿。输入第一行输入一个正整数N表示共有n次测

2015-12-31 01:18:34 494

原创 多线程之线程创建的两种方法(Java)

方法1:通过Thread继承类,修改run()方法来实现多线程。package 线程的创建1;public class example1 { public static void main(String[] args) { MyThread myThread=new MyThread();//创建线程MyThread的线程对象 myThread.start(); //开启线

2015-12-29 23:17:42 456

原创 接口强化练习(Java)

package 接口example1;interface PCI { void start(); void stop();}package 接口example1;public class NetWorkCard implements PCI { public void start() { System.out.println("Send..."); } public

2015-12-29 23:03:20 689

原创 哒哒租车系统(慕课网学习)

设计一个租车系统,车有载货和载人,也有既载货又载人的车,模拟租车系统,实现一点小功能!综合运用所学知识,完善系统(异常处理,接口使用,封装继承等等~)异常处理还是有些缺陷,对选车过程中输错序号还没有很好的处理,等掌握的知识多了再来解决。代码如下:package example1;public class Car { private int carNumber;

2015-12-28 23:59:44 3535

原创 史密斯夫妇握手问题

题目:史密斯夫妇邀请另外四对夫妇就餐,已知他们每个人都不和自己握手、不和自己的配偶握手、且不和同一个人握手一次以­上。在大家见面握手寒暄后,史密斯问大家握手了几次,每个人的答案都不一样。问:史密斯太太握手几次。问题的关键:每个人握手的次数是不确定(随意)的,比如A,B,C,D四个人(没有夫妻这一说),假如:第一次A和其他三个人握手,第二次B可以和C,D握手,最多握两次,

2015-12-28 23:21:19 4363

转载 c++中vector的用法详解

原文出自:hancunai0017vector(向量): C++中的一种数据结构,确切的说是一个类.它相当于一个动态的数组,当程序员无法知道自己需要的数组的规模多大时,用其来解决问题可以达到最大节约空间的目的.     用法:          1.文件包含:                首先在程序开头处加上#include以包含所需要的类文件vector

2015-12-26 17:18:52 386

原创 The SetStack Computer(UVa12096&&POJ3121) (集合栈)

The SetStack ComputerTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 1095 Accepted: 219DescriptionBackground from Wikipedia: "Set theory is a branch of ma

2015-12-26 16:59:22 984

原创 愚人节的礼物(杭电1870)(水题一道~)

愚人节的礼物Time Limit: 5000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7253    Accepted Submission(s): 4371Problem Description四月一日快到了,Vayko想了个愚人的

2015-12-24 20:04:06 441

原创 Windows Message Queue(杭电oj1509)(优先队列)

Windows Message QueueTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 4852    Accepted Submission(s): 1936Problem DescriptionMess

2015-12-24 09:38:55 844

原创 看病要排队(杭电oj1873)(优先队列)

看病要排队Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6626    Accepted Submission(s): 2722Problem Description看病要排队这个是地球人都知道的常识。

2015-12-24 02:05:35 1034

原创 JAVA集合类练习

在HashSet集合中添加三个Person对象,把姓名相同的人当做同一个人,禁止重复添加。提示: Person类中定义name和age属性,重写hashCode()方法和equals()方法,针对Person类的name属性进行比较,如果name相同,hashCode()方法的返回值相同,equals方法返回true。代码:package Experiment.cqm;import

2015-12-23 17:54:19 5146

原创 JAVA接口练习(含返回值)

要求:设计一个Shape接口和它的两个实现类Square和Circle,要求如下:1)Shape接口中有一个抽象方法area(),方法接收有一个double类型的参数,返回一个double类型的结果2)Square和Circle中实现了Shape接口的area()抽象方法,分别求正方形和圆形的面积并返回在测试类中创建Square和Circle对象,计算边长为2的正方形面积和半径为3的圆形面

2015-12-23 17:05:39 5422

原创 Flipper(杭电3328)(模拟栈)

FlipperTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 693    Accepted Submission(s): 421Problem DescriptionLittle Bobby Roberts

2015-12-23 16:00:12 498

原创 Train Problem I(杭电1022)(栈的应用)

Train Problem ITime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 27858    Accepted Submission(s): 10565Problem DescriptionAs the n

2015-12-22 00:46:37 592

原创 ACboy needs your help again!(杭电1702)(栈和队列的基础应用)

ACboy needs your help again!Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4832    Accepted Submission(s): 2473Problem Description

2015-12-21 18:08:12 686 2

原创 Rails(UVa514)(栈)

Rails There is a famous railway station in PopPush City. Country there is incredibly hilly. The station was built in last century. Unfortunately, funds were extremely limited that time. It

2015-12-21 07:13:43 4444

原创 顺序表的基本操作

任务:编写一个程序,实现顺序表的创建,删除,查找,输出!例如:代码实现:#includeusing namespace std;#define OK 1#define ERROR 0#define OVERFLOW -2typedef int Status; //Status 是函数返回值类型,其值是函数结果状态代码。typedef int ElemT

2015-12-20 11:34:26 1031

原创 Smith Numbers(Poj1142)(质因数分解+素数判定)

Smith NumbersTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 13142 Accepted: 4484DescriptionWhile skimming his phone directory in 1982, Albert Wilansky,

2015-12-19 21:41:26 733

原创 The Euler function(hdoj2824)(快速求欧拉函数)

The Euler functionTime Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4757    Accepted Submission(s): 1990Problem DescriptionThe Eul

2015-12-18 21:46:22 1279

原创 Farey Sequence(Poj2478)(快速求欧拉函数)

Farey SequenceTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 13883 Accepted: 5489DescriptionThe Farey Sequence Fn for any integer n with n >= 2 is the

2015-12-18 21:27:31 731

原创 Visible Lattice Points(Poj3090)(欧拉函数运用)

Visible Lattice PointsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 6167 Accepted: 3674DescriptionA lattice point (x, y) in the first quadrant (x an

2015-12-18 12:36:20 514

原创 Primitive Roots(Poj1284)(欧拉函数+原根)

Primitive RootsTime Limit: 1000MS Memory Limit: 10000KTotal Submissions: 3462 Accepted: 2025DescriptionWe say that integer x, 0 i mod p) | 1 <= i <= p-1 } is equa

2015-12-17 13:18:32 527

原创 GCD Again(杭电oj1787)(欧拉函数)

GCD AgainTime Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2732    Accepted Submission(s): 1157Problem DescriptionDo you have spen

2015-12-17 11:26:40 474

原创 分数拆分(Fractions Again?!,UVa 10976)

It is easy to see that for every fraction in the form 1k(k > 0), we can always find two positive integersx and y, x ≥ y, such that:1k=1x+1yNow our question is: can you write a p

2015-12-16 11:21:31 794

原创 Math类与Random类使用(Java)

在学习Math类与Random类之前,先介绍一个很有用的System类的方法格式:arraycopy(Object src,int srePos,Object dest,int desePos,int length)src:表示源数组dest:表示目标数组srcPos:表示源数组中拷贝元素的起始位置destPos:表示拷贝到目标数组的起始位置length:表示拷贝元素的个数

2015-12-15 22:54:49 1433

原创 StringBuffer类常用方法(Java)

StringBuffer类和String 类最大的区别在于他的内容和长度都是可以改变的。。常用方法演示:(课本上源代码)package example1.cpm;public class Example { public static void main(String[] args) { System.out.println("1,添加--------------");

2015-12-15 21:40:18 1313

原创 最大乘积(Maximum Product,UVa11059)

Given a sequence of integers S = {S1, S2, . . . , Sn}, you should determine what is the value of themaximum positive product involving consecutive terms of S. If you cannot find a positive sequence,

2015-12-15 10:45:01 1175

原创 除法(Division,UVa 725)

Division Write a program that finds and displays all pairs of 5-digit numbers that between them use the digits 0through 9 once each, such that the first number divided by the second is equ

2015-12-14 22:39:39 720

原创 救济金发放(The Dole Queue,UVa33)

The Dole Queue In a serious attempt to downsize (reduce) the dole queue, The New National Green Labour Rhinoceros Party has decided on the following strategy. Every day all dole applicants

2015-12-14 16:16:22 1280

原创 刽子手游戏(Hangman judge,Uva489)

Hangman Judge In ``Hangman Judge,'' you are to write a program that judges a series of Hangman games. For each game, the answer to the puzzle is given as well as the guesses. Rules are the

2015-12-13 22:40:19 2500

原创 古老的密码(Poj2159)

Ancient CipherTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 31217 Accepted: 10209DescriptionAncient Roman empire had a strong government system with v

2015-12-13 21:44:39 686

原创 指针总结和分享

关于指针,由于做题中很少使用指针,我一直都没有好好的总结过,但是在数据结构中很多代码还是使用到了指针方面的知识,所以还是总结一下,供自己使用。1  输入a和b两个整数,用指针实现按先大后小的顺序输出。#includeint main(){ int *p1,*p2,*p,a,b; scanf("%d%d",&a,&b); p1=&a; p2=&b; if(a<b){

2015-12-10 22:34:58 322

原创 UVA10815 Andy's First Dictionary(STL)

Andy's First DictionaryAndy, 8, has a dream - he wants to produce his very own dictionary. This is not an easy task for him, as the number of words that he knows is, well, not quite enough. Instea

2015-12-10 19:44:11 1682

转载 C++ stringstream介绍,使用方法与例子

今天在学STL中 (集合:set)时,发现stringstream,然而并不知道什么意思。经过网上的查询,才知道是一种输入输出流,由于刚接触,感觉这博文感觉很有帮助,所以转载,供以后使用。http://blog.csdn.net/joeblackzqq/article/details/7032703C++引入了ostringstream、istr

2015-12-10 19:30:32 1081

原创 大理石在哪儿(UVa 10474)(排序与检索)

大理石在哪儿现有N个大理石,每个大理石上写了一个非负整数、首先把各数从小到大排序然后回答Q个问题。每个问题问是否有一个大理石写着某个整数x,如果是,还要回答哪个大理石上写着x。排序后的大理石从左到右编号为1~N。(在样例中,为了节约篇幅,所有大理石的数合并到一行,所有问题也合并到一行。)样例输入:4 12 3 5 155 21 3 3 3 1

2015-12-10 07:40:57 1100

原创 倒三角形和等腰三角形

输入正整数n#includeint main(){ int i,j,k,n; while(~scanf("%d",&n)) { //打印倒三角形 printf("打印出倒三角形为:\n"); for(i=n;i>=0;i--) { //控制每行的空格数。 for(j=0;j<=n-i;j++) { printf(" ");

2015-12-09 17:41:52 848

原创 Java学习之异常练习

关于java中异常和异常处理也看了很多。try,catch语句,throws,throw关键字的使用,还有一些自定义异常。以下是我在慕课网学习中的一道题。虽然简单。但很有代表性,我感觉对于初学者来说会有很大帮助。package example3;import java.util.Scanner;public class Test { public static Scanne

2015-12-08 21:13:41 420

空空如也

空空如也

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

TA关注的人

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