2011年8月13日

java 类

摘要: import java.util.Scanner;class add { /* * 一个Java程序文件中,可以同时有好几个类,但是只有一个类能加上public的限定词 * ,而且要求程序的文件名称和限定的public的类名称一样。class关键字说明这是一个类。 */ public int a, b; public int Add() { return a + b; }}public class _class { public static void main(String args[]) { Scanner cin = new Scanner(System.in); add A = new 阅读全文

posted @ 2011-08-13 21:24 more think, more gains 阅读(194) 评论(0) 推荐(0) 编辑

JAVA处理大数入门 转载

摘要: 在用C或者C++处理大数时感觉非常麻烦,但是在JAVA中有两个类BigInteger和BigDecimal分别表示大整数类和大浮点数类,两个类的对象能表示最大范围理论上能够表示无线大的数,只要计算机内存足够大。 这两个类都在java.math.*包中,因此每次必须在开头处引用该包。Ⅰ基本函数:1.valueOf(parament); 将参数转换为制定的类型比如 int a=3;BigInteger b=BigInteger.valueOf(a);则b=3;String s=”12345”;BigInteger c=BigInteger.valueOf(s);则c=12345; 2.add(). 阅读全文

posted @ 2011-08-13 20:50 more think, more gains 阅读(525) 评论(0) 推荐(0) 编辑

java fibonacci Numbers

摘要: 1599: Fibonacci NumbersTime Limit: 1 SecMemory Limit: 128 MBSubmit: 53Solved: 23[Submit][Status][Web Board]DescriptionA Fibonacci sequence is calculated by adding the previous two members of the sequence, withthe rst two members being both 1.f(1) = 1; f(2) = 1; f(n > 2) = f(n 1) + f(n 2)InputYour 阅读全文

posted @ 2011-08-13 20:42 more think, more gains 阅读(229) 评论(0) 推荐(0) 编辑

导航