上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 42 下一页
新学到的:字符串去掉前导0;字符串的前缀去掉字符串的若干前缀View Code 1 import java.math.*; 2 import java.io.*; 3 import java.util.*; 4 public class Main{ 5 public static void main(String args[]) 6 { 7 Scanner cin=new Scanner(System.in); 8 int n,i; 9 BigDecimal r,a;10 BigDecimal one=new B... Read More
posted @ 2011-11-11 12:31 Because Of You Views(237) Comments(0) Diggs(0) Edit
View Code 1 import java.math.*; 2 import java.io.*; 3 import java.util.*; 4 public class Main{ 5 public static void main(String args[]) 6 { 7 Scanner cin=new Scanner(System.in); 8 int i,j,k,n,t; 9 BigInteger a,b,ans;10 t=cin.nextInt();11 i=0;1... Read More
posted @ 2011-11-11 12:19 Because Of You Views(250) Comments(0) Diggs(0) Edit
卡特兰数 C(2*n,n)/(n+1);View Code 1 //java 卡特兰数 2 import java.math.*; 3 import java.io.*; 4 import java.util.*; 5 public class Main{ 6 public static void main(String args[]) 7 { 8 Scanner cin=new Scanner(System.in); 9 int i,j,k,n;10 BigInteger a,b,ans;11 while(c... Read More
posted @ 2011-11-11 11:50 Because Of You Views(238) Comments(0) Diggs(0) Edit
http://hi.baidu.com/acmdearway/blog/item/e08db230563e3d13ebc4afa2.htmlString st = Integer.toString(num, base); // 把num当做10进制的数转成base进制的st(base <= 35).int num = Integer.parseInt(st, base); // 把st当做base进制,转成10进制的int(parseInt有两个参数,第一个为要转的字符串,第二个为说明是什么进制).BigInter m = new BigInteger(st, base); // st是 Read More
posted @ 2011-11-11 11:00 Because Of You Views(198) Comments(0) Diggs(0) Edit
无向图的最小环:从某个点出发走回自己的最短路径,路径上至少有三个点搜索做法:View Code 1 //PKU 1734 无向图的最小环,搜索做法 2 #include 3 #include 4 #include 5 using namespace std; 6 const int N = 110... Read More
posted @ 2011-11-10 22:06 Because Of You Views(1624) Comments(1) Diggs(1) Edit
开始有点小郁闷,原因是编译器坏了,囧~View Code 1 #include<stdio.h> 2 #include<math.h> 3 const double eps = 1e-9; 4 double p[10010]; 5 int n,k; 6 int solve(double x) 7 { 8 int ans=0; 9 for(int i=0;i<n;i++) 10 ans+=int(p[i]/x); 11 return ans;12 }13 int main()14 {15 while(scanf("%d%d",&n... Read More
posted @ 2011-11-10 09:27 Because Of You Views(355) Comments(0) Diggs(0) Edit
这两题基本是一样的,模拟球队之间对战、晋级,整个过程就是一颗满二叉树,最终根节点的位置就是冠军这道题目有一个很神奇的地方,改天我会仔细解释,现在先留着代码View Code 1 #include<stdio.h> 2 #include<string.h> 3 double p[130][130]; 4 double dp[130][8]; 5 int main(){ 6 int i,j,t,cases=1; 7 char str[20][20]; 8 scanf("%d",&t); 9 while(t--){10 for(i=0;i<1 Read More
posted @ 2011-11-09 22:00 Because Of You Views(332) Comments(0) Diggs(0) Edit
View Code 1 #include<stdio.h> 2 #include<string.h> 3 #include<queue> 4 using namespace std; 5 struct node{ 6 char s[20]; 7 int canshu; 8 int priority; 9 int num;10 bool operator < (const node&b) const{11 if(priority==b.priority)12 return num>b.num;13 ... Read More
posted @ 2011-11-08 22:03 Because Of You Views(291) Comments(0) Diggs(0) Edit
小数的幂计算注意toPlainString的使用,表示非科学计数法View Code 1 import java.io.*; 2 import java.awt.*; 3 import java.math.*; 4 import java.text.*; 5 import java.util.*; 6 7 public class Main { 8 9 public static void main(String[] args) {10 Scanner scan = new Scanner(new BufferedInputStream(System.in));1... Read More
posted @ 2011-11-08 14:00 Because Of You Views(267) Comments(0) Diggs(0) Edit
最近每天一道javaView Code 1 import java.io.*; 2 import java.awt.*; 3 import java.math.*; 4 import java.text.*; 5 import java.util.*; 6 public class Main { 7 public static void main(String[] args) { 8 Scanner cin=new Scanner(System.in); 9 BigInteger a,c;10 while(cin.hasNext())1... Read More
posted @ 2011-11-08 13:30 Because Of You Views(205) Comments(0) Diggs(0) Edit
上一页 1 ··· 26 27 28 29 30 31 32 33 34 ··· 42 下一页