java
文章平均质量分 80
饿狼干爹
理想是丰满的,现实是骨干的
展开
-
杭电1715(大菲波数)
点击打开杭电1715 Problem Description Fibonacci数列,定义如下: f(1)=f(2)=1 f(n)=f(n-1)+f(n-2) n>=3。 计算第n项Fibonacci数值。 Input 输入第一行为一个整数N,接下来N行为整数Pi(1 Output 输出为N行,每行为对应的f(Pi)。 Sample原创 2015-04-23 14:24:29 · 897 阅读 · 0 评论 -
杭电1263(水果)
点击打开杭电1263 Problem Description 夏天来了~~好开心啊,呵呵,好多好多水果~~ Joe经营着一个不大的水果店.他认为生存之道就是经营最受顾客欢迎的水果.现在他想要一份水果销售情况的明细表,这样Joe就可以很容易掌握所有水果的销售情况了. Input 第一行正整数N(0 每组测试数据的第一行是一个整数M(0 Output 对原创 2015-04-17 16:53:48 · 1131 阅读 · 0 评论 -
杭电1003(Max Sum) 首次dp
点击打开杭电1003 Problem Description Given 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 i原创 2015-04-29 10:18:47 · 1034 阅读 · 0 评论 -
杭电4608(I-number) java写很容易 就是超内存!!!
不用java就用大数模板做见hdu1002,java写很容易 就是超内存!!! Problem Description The I-number of x is defined to be an integer y, which satisfied the the conditions below: 1. y>x; 2. the sum of each digit of y(under原创 2015-04-27 15:10:09 · 727 阅读 · 0 评论 -
素数筛选法
public class PrimeFilter2{ public static void main(String args[]){ int a[]={2,3,5,7}; print(a); int b[] = filter(a,100); print(b); int c[] = filter(b,10000); print(c原创 2015-04-27 14:08:07 · 590 阅读 · 0 评论 -
杭电1024(Max Sum Plus Plus)
点击打开杭电1024 Problem Description Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now you are faced wi原创 2015-04-30 10:57:09 · 793 阅读 · 0 评论 -
杭电1503(Advanced Fruits)
点击打开杭电1503 Problem Description The company "21st Century Fruits" has specialized in creating new sorts of fruits by transferring genes from one fruit into the genome of another one. Most times thi原创 2015-04-30 14:06:20 · 1114 阅读 · 0 评论 -
杭电1159(Common Subsequence)LCS和dp
点击打开杭电1159 Problem Description A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of原创 2015-04-30 12:39:54 · 768 阅读 · 0 评论 -
LCS(最长公共子序列)和dp(动态规划)
参照:v_JULY_v 最长公共子序列定义: 注意最长公共子串(Longest CommonSubstring)和最长公共子序列(LongestCommon Subsequence, LCS)的区别:子串(Substring)是串的一个连续的部分,子序列(Subsequence)则是从不改变序列的顺序,而从序列中去掉任意的元素而获得的新序列;更简略地说,前者(子串原创 2015-04-30 12:15:49 · 3736 阅读 · 0 评论 -
杭电2031(进制转换)
点击打开杭电2031 Problem Description 输入一个十进制数N,将它转换成R进制数输出。 Input 输入数据包含多个测试实例,每个测试实例包含两个整数N(32位整数)和R(210)。 Output 为每个测试实例输出转换后的数,每个输出占一行。如果R大于10,则对应的数字规则参考16进制(比如,10用A表示,等等)。 Sa原创 2015-05-10 22:47:05 · 769 阅读 · 0 评论 -
面试题:字符串截取
字符串截取 题目:在java中,字符串“abcd”与字符串“ab你好”的长度是一样,都是四个字符。但对应的字节数不同,一个汉字占两个字节。定义一个方法,按照指定的字节数来取子串。如: 对于“ab你好”,如果取三个字节,那么子串就是ab与“你”字的半个,那么半个就要舍弃。如果取四个字节就是“ab你”,取五个字节还是“ab你”。 解题思路:咋一看,以为就是注意汉字字节时的处理问题。其实还应该原创 2015-08-12 19:39:23 · 1032 阅读 · 1 评论 -
杭电2054(A == B ?)详解
杭电2054 Problem Description Give you two numbers A and B, if A is equal to B, you should print "YES", or print "NO". Input each test case contains two numbers A and B. Output for ea原创 2015-04-11 11:15:07 · 2579 阅读 · 0 评论 -
文件切割机
文件切割与合并 要求:实现对大文件的切割与合并。 按指定个数切(如把一个文件切成10份)或按指定大小切(如每份最大不超过10M),这两种方式都可以。 程序说明: 文件切割:把一个文件切割成多个碎片,每个碎片的大小不超过1M。自己可把功能进一步扩展:切割前的文件名、长度,切割后的碎片个数、文件名等信息可写到第一个碎 片中或另外用properties把这些写到配置文件中。 文件合并原创 2015-08-13 00:03:26 · 1561 阅读 · 1 评论 -
学习----面向对象编程
1、日期的封装 public class MyDate{ int year,month,day; private static int thisYear; static { thisYear=2008; } public MyDate(int year,int month,int day){ this.set(year,month,day); } public MyDate原创 2015-04-16 21:29:11 · 553 阅读 · 0 评论 -
杭电2024(C语言合法标识符)
杭电2024 Problem Description 输入一个字符串,判断其是否是C的合法标识符。 Input 输入数据包含多个测试实例,数据的第一行是一个整数n,表示测试实例的个数,然后是n行输入数据,每行是一个长度不超过50的字符串。 Output 对于每组输入数据,输出一行。如果输入数据是C的合法标识符,则输出"yes",否则,输出“no”。原创 2015-04-10 17:25:13 · 1105 阅读 · 2 评论 -
杭电1042(N!)
点击打开杭电1042 Problem Description Given an integer N(0 ≤ N ≤ 10000), your task is to calculate N! Input One N in one line, process to the end of file. Output For each N, output N! i原创 2015-04-23 14:06:28 · 1117 阅读 · 0 评论 -
蚂蚁过杆问题(二) ------java面向对象处理
问题:有一根27厘米的细木杆,在第3厘米、7厘米、11厘米、18厘米、23厘米这五个位置上各有一只蚂蚁。木杆很细,不能同时通过两只蚂蚁。开始时,蚂蚁的头朝左还是朝右是任意的,它们只会朝前走或调头,但不会后退。当任意两只蚂蚁碰头时,两只蚂蚁会同时调头朝反方向走。假设蚂蚁们每秒钟可以走一厘米的距离。编写程序,求所有蚂蚁都离开木杆的最小时间和最大时间。 思路:因为没有告诉蚂蚁的初始朝向原创 2015-04-13 23:08:32 · 833 阅读 · 0 评论 -
杭电1047(Integer Inquiry)java水过
点击打开杭电1047 Problem Description One of the first users of BIT's new supercomputer was Chip Diller. He extended his exploration of powers of 3 to go from 0 to 333 and he explored taking various sums o原创 2015-04-24 09:00:43 · 900 阅读 · 0 评论 -
杭电1316(How Many Fibs?)
点击打开杭电1316 Problem Description Recall the definition of the Fibonacci numbers: f1 := 1 f2 := 2 fn := fn-1 + fn-2 (n >= 3) Given two numbers a and b, calculate how many Fibonacci numbers ar原创 2015-04-24 09:29:25 · 654 阅读 · 0 评论 -
hdu2017(字符串统计)java水过
hdu2017 import java.util.*; class Main{ public static void main(String []args){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(); sc.nextLine(); while(n-->0){ String str=sc.ne原创 2015-04-10 08:30:19 · 797 阅读 · 0 评论 -
杭电2005(第几天?)java字符串水过
点击打开杭电2005 1、split的应用:将字符串以某某字符为界划分为多个字符串 2、面向对象的编程 Problem Description 给定一个日期,输出这个日期是该年的第几天。 Input 输入数据有多组,每组占一行,数据格式为YYYY/MM/DD组成,具体参见sample input ,另外,可以向你确保所有的输入数据是合法的。 Outpu原创 2015-04-16 17:51:27 · 781 阅读 · 0 评论 -
hdu1002(java水过)
hdu1002 用java里math包里面BigInteger类可以直接调用add方法进行相加。 BigInteger:不可变的任意精度的整数。所有操作中,都以二进制补码形式表示 BigInteger(如 Java 的基本整数类型)。BigInteger 提供所有 Java 的基本整数操作符的对应物,并提供 java.lang.Math 的所有相关方法。另外,BigInteger 还提供以原创 2015-04-08 12:33:47 · 778 阅读 · 0 评论 -
hdu2030(汉字统计)java水过
hdu2030 思路:汉字机内码在计算机的表达方式的描述是,使用二个字节,每个字节最高位一位为1。计算机中, 补码第一位是符号位, 1 表示为负数,所以汉字机内码的每个字节表示的十进制数都是负数,且汉字占用两个字节结果要除以2,不要忘了。 import java.util.*; class Main{ public static void main(String []args){原创 2015-04-10 09:16:15 · 1816 阅读 · 1 评论 -
hdu1002(大数相加)
点击打开链接 import java.util.*; class Main{ public static void main(String args[]){ Scanner sc=new Scanner(System.in); int n=sc.nextInt(),t=0; while(n-->0){ t++; char[] c=new char[1000];原创 2015-04-08 12:14:56 · 582 阅读 · 0 评论 -
杭电1280(前m大的数)
点击打开杭电1280 Problem Description 还记得Gardon给小希布置的那个作业么?(上次比赛的1005)其实小希已经找回了原来的那张数表,现在她想确认一下她的答案是否正确,但是整个的答案是很庞大的表,小希只想让你把答案中最大的M个数告诉她就可以了。 给定一个包含N(N<=3000)个正整数的序列,每个数不超过5000,对它们两两相加得到的N*(N-1)/2个和,原创 2015-04-16 20:57:12 · 672 阅读 · 0 评论 -
杭电1379(DNA Sorting)java面向对象编程
点击打开链杭电1379 Problem Description One measure of ``unsortedness'' in a sequence is the number of pairs of entries that are out of order with respect to each other. For instance, in the letter sequen原创 2015-04-16 20:13:26 · 837 阅读 · 0 评论 -
hdu1106(排序,java水过)
hdu1106 思路:先以字符串形式输入,以5为界限,分别装入数组中,然后将字符数组转换为整型,最后进行排序输出。 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 3原创 2015-04-08 15:58:15 · 508 阅读 · 0 评论 -
十天web实训成果
一、html基本标签 html是一种网页制作语言,。其实html跟java和其他语言差不多,都有自己的语言表达形式,就是通过标签形成的。标签又有单标签和双标签两种,理解起来还是比较容易的,纯属记忆,主要要在于什么时候用,用在哪里,这样才会显示出更美观的页面。 1、html基本模式 网页标题 我的第一个网页文档 2、常用的html标签原创 2015-07-31 13:35:03 · 1485 阅读 · 0 评论