上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 99 下一页

2011年8月15日

树状数组 求区间和

摘要: 1 #include <stdio.h> 2 #include <string.h> 3 int N,a[60000]; 4 int lowbit(int x) 5 { 6 7 return x&(-x); 8 } 9 void add(int i,int x)10 {11 while(i<=N)12 {13 a[i]+=x;14 i+=lowbit(i);15 }16 }17 int sum(int i)18 {19 int sum=0;20 while(i)21 {22 sum+=a[i];23 i-=lowbit(i);24 }25 return s 阅读全文

posted @ 2011-08-15 19:27 more think, more gains 阅读(231) 评论(0) 推荐(0) 编辑

just a hook hdu 1689线段树

摘要: Just a HookTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 5529Accepted Submission(s): 2568Problem DescriptionIn the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecut 阅读全文

posted @ 2011-08-15 19:15 more think, more gains 阅读(267) 评论(0) 推荐(0) 编辑

i hate it hdu 1754 线段树

摘要: I Hate ItTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9748Accepted Submission(s): 3656Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测 阅读全文

posted @ 2011-08-15 18:56 more think, more gains 阅读(137) 评论(0) 推荐(0) 编辑

2011年8月14日

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 阅读(169) 评论(0) 推荐(0) 编辑

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) 编辑

上一页 1 ··· 33 34 35 36 37 38 39 40 41 ··· 99 下一页

导航