随笔分类 -  java

poj 1811 Prime Test
摘要:一直RE, 据说是爆栈啦。。。。import java.math.BigInteger;import java.util.Scanner;public class prime { public static void main(String args[]) { int n, flag = 0, i; BigInteger a, b, t, c, v; Scanner cin = new Scanner(System.in); b = BigInteger.valueOf(2); n = cin.nextInt(); for (i = 0; i < n; i++) { t = cin.ne 阅读全文

posted @ 2011-08-14 09:15 more think, more gains 阅读(175) 评论(0) 推荐(0)

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 阅读(200) 评论(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 阅读(538) 评论(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 阅读(239) 评论(0) 推荐(0)

序列 java poj3982
摘要:import java.util.*;import java.io.*;import java.math.*;public class Main { public static void main(String[] args) { Scanner cin=new Scanner(System.in); BigInteger f[]=new BigInteger[101]; int i; BigInteger a,b; while(cin.hasNext()) { f[0]=cin.nextBigInteger(); f[1]=cin.nextBigInteger(); f[2]=cin.nex 阅读全文

posted @ 2011-05-10 20:08 more think, more gains 阅读(144) 评论(0) 推荐(0)

字符串替换 java/c++
摘要://javaimport java.util.*;import java.io.*;public class replace{ public static void main(String args[]) { Scanner cin=new Scanner(System.in); while(cin.hasNext()) { String str=cin.nextLine(); if(str.charAt(0)=='0') break; str=str.replaceAll("you","we"); System.out.println( 阅读全文

posted @ 2011-05-10 19:39 more think, more gains 阅读(211) 评论(0) 推荐(0)

完整版本的 poj 题目分类 转载
摘要:完整版本的 poj 题目分类2008/04/05 10:58 [优秀转载 ]DP: 1011 NTA 简单题 1013 Great Equipment 简单题 1024 Calendar Game 简单题 1027 Human Gene Functions 简单题 1037 Gridland 简单题 1052 Algernon s Noxious Emissions 简单题 1409 Communication System 简单题,但是很容易看错~~~ 1425 Crossed Matchings 简单题 1438 Asteroids! 简单题 1459 String Distance an 阅读全文

posted @ 2011-05-10 18:26 more think, more gains 阅读(280) 评论(0) 推荐(0)

hdu 1316
摘要:import java.math.BigInteger;import java.util.Scanner;public class hdu1316 { public static void main(String[] args) { Scanner cin=new Scanner(System.in); BigInteger arr[]=new BigInteger[600]; BigIntege... 阅读全文

posted @ 2011-05-10 08:44 more think, more gains 阅读(201) 评论(0) 推荐(0)

hdu 1047 Exponentiation
摘要:import java.math.BigDecimal;import java.math.BigInteger;import java.util.Scanner;public class hdu1063 { public static void main(String[] args) { Scanner cin=new Scanner(System.in); int a,i; BigDecimal... 阅读全文

posted @ 2011-05-10 08:25 more think, more gains 阅读(193) 评论(0) 推荐(0)

hdu 1047 java水过
摘要:import java.io.*;import java.util.*;import java.math.*;public class Main { public static void main(String[] args) { Scanner cin=new Scanner(System.in); int i,n; BigInteger a,b; n=cin.nextInt(); for(i=0;i<n;i++) { if(i!=0) System.out.println(); b=BigInteger.ZERO; while(cin.hasNextBigInteger()) { a 阅读全文

posted @ 2011-05-10 08:06 more think, more gains 阅读(177) 评论(0) 推荐(0)

hdu 1042
摘要:用java水过了。。937ms. import java.io.*;import java.util.*;import java.math.*;public class abc { public static void main(String[] args) { int t,i; Scanner cin=new Scanner(System.in); BigInteger sum; while(c... 阅读全文

posted @ 2011-05-10 07:47 more think, more gains 阅读(159) 评论(0) 推荐(0)

大菲波数 hdu 1715
摘要:import java.math.*;import java.util.*;import java.io.*; public class Main { public static void main(String[] args) { int n,p,i; BigInteger sum[]=new BigInteger[1005]; sum[1]=BigInteger.valueOf(1); sum... 阅读全文

posted @ 2011-05-09 21:36 more think, more gains 阅读(167) 评论(0) 推荐(0)

大明A+B
摘要:当初我写了一两个小时都没ac的大明a+b.. 哈哈。。今天我用java,用了五分钟就AC了。强大的java.. import java.io.*;import java.util.*;import java.math.*; public class Main { public static void main(String[] args) { Scanner cin=new Scanner(Sys... 阅读全文

posted @ 2011-05-09 21:12 more think, more gains 阅读(195) 评论(0) 推荐(0)

hdu 1002
摘要:哈哈,今天学了java,配置了eclipse…用java成功了AC第一题。 import java.io.*;import java.math.*;import java.util.*; public class Main { public static void main(String[] args) { int i=0,n; BigInteger a,b; Scanner cin=new Sc... 阅读全文

posted @ 2011-05-09 20:58 more think, more gains 阅读(152) 评论(0) 推荐(0)

hdu java 大数 转载
摘要:// hdu 1753 大明A+Bimport java.io.*;import java.util.*;import java.math.*;public class hdu_1753 {public static void main(String[]args){BigDecimal a,b;Scanner cin=new Scanner(System.in);while(cin.hasNextBigDecimal()){a=cin.nextBigDecimal();b=cin.nextBigDecimal();a=a.add(b);String str=a.stripTrailingZer 阅读全文

posted @ 2011-05-09 09:18 more think, more gains 阅读(198) 评论(0) 推荐(0)

java速成 转载lvsi
摘要:[转]ACM之java速成 这里指的java速成,只限于java语法,包括输入输出,运算处理,字符串和高精度的处理,进制之间的转换等,能解决OJ上的一些高精度题目。1. 输入:格式为:Scanner cin = new Scanner (new BufferedInputStream(System.in));例程:import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner 阅读全文

posted @ 2011-05-09 08:57 more think, more gains 阅读(362) 评论(0) 推荐(0)

导航