poj
@阿奇@
做一个勤勉、有趣、善良的人
展开
-
用Java提交poj的细节问题
import java.util.Scanner; public class Poj1003 {//错误 public class Main {//正确……不知道什么鬼 public static void main(String arg[]){ double a[]=new double[1000]; for(int i=2;i<990;i++){ a[i]=a[i原创 2017-10-10 00:02:38 · 1340 阅读 · 5 评论 -
poj2528&&线段树模板
二叉树模板,可实现查找,更新#include <iostream> #include <stdio.h> using namespace std; #define N 111111 long long sum[N<<2];//数组开的太大,要用宏定义,不然RE long long add[N<<2]; void pushdown(int m,int rt) { if(add[rt])原创 2017-12-12 20:36:00 · 110 阅读 · 0 评论 -
poj2299&&归并排序
#include <iostream> #include <stdio.h> //error: reference to 'left' is ambiguous|把left换成left_就好了 using namespace std; const int maxn=500010; const int INF=0x7fffffff; int s[maxn],left_[maxn],right_[max原创 2017-12-11 21:07:09 · 269 阅读 · 0 评论 -
poj1330
# include <iostream> # include <cstdio> # include <cstring> # include <string> # include <cmath> # include <vector> # include <map> # include <queue> # include <cstdlib> # define MAXN 500001 using name原创 2017-12-03 17:00:21 · 146 阅读 · 0 评论 -
poj2352
输入顺序是有规律的,只需要x的值就可以建树了,同时,边建树边查找#include <iostream> #include <stdio.h> #include <algorithm>using namespace std; const int maxn=32010; int tree[4*maxn]; int x[maxn]; int level[15010]; void build(int p,i原创 2017-12-11 15:08:26 · 110 阅读 · 0 评论 -
poj1521
#include <iostream> #include <queue> #include <string.h> #include <stdio.h> using namespace std;int main() { string s; int ch[300]; priority_queue<int ,vector<int>,greater<int> >q; whil原创 2017-12-02 21:13:07 · 247 阅读 · 0 评论 -
poj3167
这道题看别人代码看了一天,我去……功夫不行啊!#include <iostream> #include <stdio.h> #include <vector> #include <string.h>using namespace std; const int maxn=25010; int n,m,s; vector<int> ans; int sum[maxn]; int next[maxn];原创 2017-12-11 12:27:12 · 121 阅读 · 0 评论 -
poj2752
发现不优化的next数组经常用啊……#include<iostream> #include <string.h> #include <stdio.h> #include <stack> using namespace std; int next[1000010]; char p[1000010]; int pLen;void GetNext() { pLen = strlen(p);原创 2017-12-09 16:13:49 · 244 阅读 · 0 评论 -
poj2406
这题是未优化的next数组的应用#include<iostream> #include <string.h> #include <stdio.h> using namespace std; int next[1000010]; char p[1000010]; int pLen; void GetNext() { pLen = strlen(p); next[0] = -1;原创 2017-12-09 14:35:48 · 146 阅读 · 0 评论 -
poj2766
#include <iostream> #include <string.h> #include <stdio.h> using namespace std; int cases; int n,r; int x,y; int mapn[55][55]; bool solve() { int tmp; if(y==0)tmp=0; else if(y==n+1) tmp=2;原创 2017-11-04 16:35:16 · 205 阅读 · 0 评论 -
poj2528
//离散化+线段树+二分 #include <iostream> #include <stdio.h> #include <algorithm> #include <string.h> using namespace std; #define maxn 10010 int n,m,ans; int li[maxn],ri[maxn],hash_color[maxn],a[maxn*2*2*2],co原创 2017-12-13 12:30:37 · 139 阅读 · 0 评论