- 博客(98)
- 问答 (2)
- 收藏
- 关注
原创 java基础-使用Arrays管理数组排序,复制,查找,填充
//Array.copyOf(int a[]@1,int newLength@2);1是原数组2新数组的长度 //Array.copyOfRange(int a[]@1,int form@2,int to@3);1是原数组2复制开始的位置3复制结束的位置 //System.arraycopy(objiect src@1,int@2 srcPos@3,Object dest@4,int dest
2016-07-19 10:59:17
542
原创 LA3942
#include#includeusing namespace std;const int mode = 20071027;const int maxn = 310000;char str[maxn];int dp[maxn];char a[110];struct node{ int next[26]; int f;} T[4000*100];int tot;
2014-09-04 10:27:41
576
原创 LA4329
N (3 N 20000) ping pong players live along a west-east street(consider the street as a line segment). Eachplayer has a unique skill rank. To improve their skill rank, they often compete with eac
2014-09-03 17:04:58
543
原创 c++函数模板,有默认参数的函数
#include using namespace std;template //template两个都行T max(T a,T b,T c){ if(b>a) a=b; if(c>a) a=c; return a;}int main(){ int i1=185,i2=-76,i3=567,i; double d1=56.87,d2=-90.
2014-08-25 15:38:11
828
原创 C文件
#include#define SIZE 10struct student_type{ char name[10]; int num; int age; char addr[15];}stud[SIZE];void save(){ FILE *fp; int i; if((fp=fopen("st
2014-08-24 18:56:51
623
原创 共用体
//共用体变量//申明union data{ int i; char ch; double f;}a,b,c;union data a,b,c;union{ int i; char ch; double f;}a,b,c;//只能引用成员不能引用本身//初始化a={16};a
2014-08-23 09:09:43
561
原创 树状数组,二查索引树,BIT
//预处理//c[i]=a[i-lowbit(i)+1]+......a[i];for(int i=1;i<=n;i++) for(int j=i-lowbit(i)+1;j<=i;j++) c[i]+=a[j];//求和int sum(int x){ int ret=0; while(x>0) { ret+=c[x];
2014-08-21 15:03:46
547
原创 uva(10344)
#include #include#includeusing namespace std;int a[6],A[6],flag,vis[6],v[6];char b[]= {"*-+"},B[6];void dfs1(int cur){ int t; if(flag) return ; else if(cur==5) { t=A[0
2014-08-20 10:05:00
483
原创 uva146(排序)
http://vjudge.net/vjudge/problem/viewProblem.action?id=19158ID CodesTime Limit: 3000MS Memory Limit: Unknown 64bit IO Format: %lld & %llu[Submit] [Go Back
2014-08-16 10:19:45
512
原创 子集生成
/*//方法一://思路:构造一个位向量visit,而不是直接构造子集A本身#includeusing namespace std; void fun(int *visit, int cur, int n){ if(cur == n+1) { for(int i = 1;i <= n;++ i) if(visit[i])
2014-08-15 11:02:44
446
原创 uva253
设两个正方体是 c1, c2, 保持 c1 不变,枚举 c1 的相邻的三个面,和 c2 的6个面依次对比,如果这个面和其中一个面相同,并且这两个面的对面也对应相同,那么就把 c2 的这两个面标记为字符 ‘0’ ,防止以后再次用到这两个面。如果对于 c1 的这三个面的其中一个面,在 c2 中找不到符合条件(即两个面相同并且对面也相同)的,就退出循环,说明这两个正方体不相同,否则,这两个正方体相同
2014-08-14 10:41:43
618
原创 poj1001(大数据)
这个问题是要请你求出 Rn 的精确值。在这里R是一个实数(0.0 Input每组测试资料一列,包含了R,n,R的位置为第1行到第6行,n的位置为第8行到第9行。Output输出 Rn 的精确值。前后方无作用的0不应该出现。Sample input95.123 120.4321 205.1234 156.7592 9
2014-08-11 15:12:40
658
原创 字符—数字转换
atof(将字符串转换成浮点型数)atoi(将字符串转换成整型数)atol(将字符串转换成长整型数)strtod(将字符串转换成浮点数)strtol(将字符串转换成长整型数)strtoul(将字符串转换成无符号长整型数)toascii(将整型数转换成合法的ASCII 码字符)toupper(将小写字母转换成大写字母)tolower(将大写字母转换成小写字母)
2014-08-10 21:04:20
472
原创 uva10815
http://vjudge.net/problem/viewProblem.action?id=18649没有初始化#include #include#include#include#include#include#include#include#include#include#include#define INF (1<<28)using nam
2014-08-10 20:22:41
398
原创 poj1598(字符串处理)
#include #include#include#include#include#include#include#include#include#include#include#include#define INF 1<<28using namespace std;struct node{ int sum,no; char s[200];
2014-08-10 16:30:31
444
原创 hdu1166(线段树)
http://acm.hdu.edu.cn/showproblem.php?pid=1166敌兵布阵Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 43122 Accepted Submission(s): 18259
2014-08-06 21:17:40
414
原创 hdu1754(线段树)
http://acm.hdu.edu.cn/showproblem.php?pid=1754***重磅消息——[BestCoder Round #4]冠军将获得iPad Mini一部! 《BestCoder用户手册》下载I Hate ItTime Limit: 9000/3000 MS (Java/Others) M
2014-08-06 21:13:17
410
原创 poj3624(线段树)
例题: POJ 3264 Balanced Lineup给定Q (1 ≤ Q ≤ 200,000)个数A1,A2… AQ,,多次求任一区间Ai– Aj中最大数和最小数的差。本题树节点结构:struct CNode{int L,R; //区间起点和终点int minV,maxV; //本区间里的最大最小值CNode * pLeft, * pRight;};
2014-08-06 17:14:04
508
原创 poj2255(二叉树重建)
http://poj.org/problem?id=2255#include #include#include#include#include#include#include#include#include#include#include#define INF 1<<30using namespace std;void bulid(i
2014-08-06 15:24:52
2006
原创 poj3321(树状数组)
http://poj.org/problem?id=3321There is an apple tree outside of kaka's house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he has been carefully nurturing
2014-08-06 10:44:16
481
原创 百炼(2755)dp
2755:神奇的口袋ViewSubmitStatisticsHintClarify总Time Limit: 10000ms Memory Limit: 65536kBDescription有一个神奇的口袋,总的容积是40,用这个口袋可以变出一些物品,这些物品的总体积必须是40。John现在有n个想要得到的物品,每个物品的体积分别是a1,a2……an。Jo
2014-08-04 10:52:16
610
原创 poj1458(最长公共子序列dp)
#include #include using namespace std;char sz1[1000];char sz2[1000];int maxLen[1000][1000];int main(){ while( cin >> sz1 >> sz2 ) { int length1 = strlen( sz1); int lengt
2014-08-04 10:20:43
568
原创 poj1330( 树的先跟遍历)
#include#include#include#include#includeusing namespace std;const int N=10010;vector a[N];int f[N],r[N];void DFS(int u,int dep){ r[u]=dep; for(vector::iterator it=a[u].begin()
2014-08-03 18:00:04
517
原创 poj1459最大流
#include #include#include#include#include#include#include#include#include#include#include#define INF 1<<30using namespace std;int n,np,nc,m,s,t;int fa[102],q[104],f[104][104],c[104][104
2014-08-01 16:40:53
448
原创 poj3125(优先队列数组实现)
#include#includeusing namespace std;const int maxn=100+5;int main(){ int loop; cin>>loop; while(loop--) { int n,m; cin>>n>>m; int st,ed,a[maxn];
2014-07-26 11:30:30
911
空空如也
关于c,c++,和java的一个问题
2016-12-22
c++代码文件包含没有用到的头文件有什么影响吗?
2014-07-25
TA创建的收藏夹 TA关注的收藏夹
TA关注的人