上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 47 下一页

2012年5月24日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1872稳定排序,用一个变量idx记录位置保持稳定View Code #include <iostream>#include <cstdlib>#include <cstring>#include <string>#include <stack>#include <queue>#include <map>using namespace std;typedef struct L{ char name[51]; int score; 阅读全文
posted @ 2012-05-24 22:04 LegendaryAC 阅读(246) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1022STL中栈的应用练习,数组要开够啊。。。无语View Code #include <iostream>#include <stack>using namespace std;int main(){ stack <char> s; char in[11],out[11]; int n; bool flag[30]; while(~scanf("%d%s%s",&n,in,out)) { int i,j,cnt; i=j=cnt=0; ... 阅读全文
posted @ 2012-05-24 16:30 LegendaryAC 阅读(142) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1273乱搞题,n-1减去起点,把剩下的点分成尽可能相等的两部分1、2(为了得到尽可能大的答案),对于1内部来讲,显然总能保证“新鲜”,在新鲜1后,不难看出2的每个点都对应着一个“新鲜”说的乱七八糟,大概就这样吧。。。View Code #include <iostream>#include <queue>#include <stack>#include <vector>using namespace std;int main(){ int n; while(sc 阅读全文
posted @ 2012-05-24 13:46 LegendaryAC 阅读(244) 评论(0) 推荐(0) 编辑

2012年5月23日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=3584裸三维树状数组。。。除了三维的容斥要稍微想一下别的都和一维、二维的一样了View Code #include <iostream>using namespace std;const int MAX=101;int n;int tree[MAX][MAX][MAX];int lowbit(int i){ return i&(-i);}void update(int x,int y,int z){ for(int i=x;i<=n;i+=lowbit(i)) for(int j=y 阅读全文
posted @ 2012-05-23 19:11 LegendaryAC 阅读(136) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2642裸二维树状数组,没有秒杀,坑点是这题的询问是x1,x2,y1,y2(其实题目说得清清楚楚,惯性思维害死人?写完不过sample无力吐槽)。然后犯了一个巨2的笔误,死活没查出来,还是让路人王同学看出来的、、、、跪了View Code #include <iostream>using namespace std;const int MAX=1010;int vis[MAX][MAX],tree[MAX][MAX];int lowbit(int i){ return i&(-i);}voi 阅读全文
posted @ 2012-05-23 13:12 LegendaryAC 阅读(255) 评论(0) 推荐(0) 编辑

2012年5月22日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1892二维树状数组,很裸。。。View Code #include <iostream>#include <algorithm> #include <cstring>using namespace std;const int MAX=1010;int weight[MAX][MAX],tree[MAX][MAX];int lowbit(int i){ return i&(-i);}void update(int x,int y,int val){ for(int i 阅读全文
posted @ 2012-05-22 21:40 LegendaryAC 阅读(132) 评论(0) 推荐(0) 编辑

2012年5月21日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1150二分图最大匹配,匈牙利算法View Code #include #include const int MAX1=101;const int MAX2=1001;int k,m,n;int match[MAX1... 阅读全文
posted @ 2012-05-21 17:55 LegendaryAC 阅读(134) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1063依然是高精度,和上一题很像,不过用上一题的方法一直超时?颇为费解。查了几个函数的用法,直接用函数操作就不超时了?这题mark一下以后还要再看,对超时表示不太理解。stripTrailingZeros()是去掉后缀0,toPlainString()是转成非指数型的字符串(上一题要知道这两个函数直接秒杀了哈。。。)。startsWith("//字符串1")判断给定字符串是否以字符串1开头(对应的还有endsWith())。substring()的用法参考百度百科,看一眼就明白了:&quo 阅读全文
posted @ 2012-05-21 11:38 LegendaryAC 阅读(140) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1753在小数点存在的情况下去掉后面的0View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); BigDecimal a... 阅读全文
posted @ 2012-05-21 10:38 LegendaryAC 阅读(146) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1047大数View Code import java.io.*;import java.math.*;import java.util.*;import java.text.*;public class Main{ public static void main(String[] args) { Scanner cin=new Scanner (new BufferedInputStream(System.in)); BigInteger sum,a; i... 阅读全文
posted @ 2012-05-21 10:09 LegendaryAC 阅读(112) 评论(0) 推荐(0) 编辑
上一页 1 ··· 29 30 31 32 33 34 35 36 37 ··· 47 下一页