上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 17 下一页
摘要: 题目:http://poj.org/problem?id=3393一道题目挺长的模拟题,参考了网上大神的题解。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 int Month[13]={0,31,28,31,30,31,30,31,31,30,31,30,31}; 8 int Lmonth[13]={0,31,29,31,30,31,30,31,31,30,31,30,31}; 9 10 int check(int year) 11 { 12 if(year1... 阅读全文
posted @ 2014-01-17 23:05 水门 阅读(195) 评论(0) 推荐(0) 编辑
摘要: 二分查找递归算法 1 #include 2 #include 3 #include 4 using namespace std; 5 #define MAXL 10000 6 7 int a[MAXL],key; 8 int BinarySearch(int low,int high) 9 ... 阅读全文
posted @ 2014-01-17 19:50 水门 阅读(248) 评论(0) 推荐(0) 编辑
摘要: 插入排序 1 #include 2 #include 3 #include 4 using namespace std; 5 #define MAXL 10000 6 7 void InsertSort(int a[],int n) 8 { 9 int i,j,temp;10 ... 阅读全文
posted @ 2014-01-17 19:47 水门 阅读(303) 评论(0) 推荐(0) 编辑
摘要: 上几次的一道cf题。题目:http://codeforces.com/contest/376/problem/C性质:(4)a与b的和除以c的余数(a、b两数除以c在没有余数的情况下除外),等于a,b分别除以c的余数之和(或这个和除以c的余数)。例如,23,16除以5的余数分别是3和1,所以(23+16)除以5的余数等于3+1=4。注意:当余数之和大于除数时,所求余数等于余数之和再除以c的余数。例如,23,19除以5的余数分别是3和4,所以(23+19)除以5的余数等于(3+4)除以5的余数。(5)a与b的乘积除以c的余数,等于a,b分别除以c的余数之积(或这个积除以c的余数)。例如,23,1 阅读全文
posted @ 2014-01-04 13:35 水门 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1961题意:跟2406 差不多,算是2406的升级版。就是每一个字符都要加一个判断。。next匹配 1 #include 2 #include 3 #include 4 using namespace std; 5 6 char t... 阅读全文
posted @ 2013-12-28 14:25 水门 阅读(179) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=2406题意:给一个字符串,求这个字符串 能由一个子串最多组成多少次。。next_val匹配 1 #include 2 #include 3 #include 4 using namespace std; 5 6 char t[1000005]; 7 int len_t,nev[1000005]; 8 int get_nextv() 9 {10 int i=0,j=-1,x;11 nev[0]=-1;12 while(i 2 #include 3 #include 4 using namespace ... 阅读全文
posted @ 2013-12-26 23:19 水门 阅读(165) 评论(0) 推荐(0) 编辑
摘要: 今天照着课本敲了一下KMP..以OJ上的一个题为例敲了一下。。题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2125 1 #include 2 #include 3 #include 4 us... 阅读全文
posted @ 2013-12-26 20:34 水门 阅读(203) 评论(0) 推荐(0) 编辑
摘要: 这场cf 做的很差,,第一题犯了一个很低级的错误。。把i写成了J....第二题 想的太复杂了。。。其实我们只需要 考虑每个人自己的负债情况就行了,就是假设每个人把别人欠他的钱,拿过来还给别人。。这就是最简单的欠债关系了。。。在做题的过程中也没有专心。。做了以后就去干其他事了最后就是一道题也没有过,rating已经掉的不行了。。题目:http://codeforces.com/contest/376/problem/Ahttp://codeforces.com/contest/376/problem/B 1 #include 2 #include 3 #include 4 using na... 阅读全文
posted @ 2013-12-25 23:58 水门 阅读(221) 评论(0) 推荐(0) 编辑
摘要: 题目:189B - Counting Rhombihttp://codeforces.com/problemset/problem/189/B题意:给定一个长方形的 矩形,求能在这个矩形里有多少 对角线跟坐标垂直的菱形思路:枚举这个菱形的中心的那一个点,然后找这个点 离边界比较小的那一个距离这样利用... 阅读全文
posted @ 2013-12-21 20:15 水门 阅读(367) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/contest/374/problem/A题意:求到达边界的最小步数。。刚开始以为是 bfs,不过数据10^6太大了,肯定不是。。。一个思维题,要注意超边界。。。 1 #include 2 #include 3 #include 4 using... 阅读全文
posted @ 2013-12-19 17:28 水门 阅读(332) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=3007题意:按照图示的改变字符串,问有多少种。。字符串。。思路:分几种排序的方法,,刚开始用map 超时(map效率不高啊。。),后来搜了一下题解,用二叉排序树。。。先贴AC代码: 1 #include 2 #include 3 ... 阅读全文
posted @ 2013-12-19 13:50 水门 阅读(304) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2482感觉树这一部分掌握的真心不好,以前练习的一道题,当时不会,今天参考了一下别人的代码,出了点错误,但终于A了。。。。。 1 #include 2... 阅读全文
posted @ 2013-12-09 21:35 水门 阅读(222) 评论(0) 推荐(0) 编辑
摘要: 题目:http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=430题意:两个字符串,第二个不能错七次,不能重复思路:今天是帮学弟看题的,没帮学弟看出错误来。。。真惭愧。。。于是自己写了一个。。 1 #include 2 #include 3 using namespace std; 4 5 int main() 6 { 7 int x,i,j,f[200]; 8 char s1[10000],s2[10000]; 9 int s1... 阅读全文
posted @ 2013-12-06 00:37 水门 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2721题意:给定n个左标,跟那n个坐标相同的 且3个以上的消失,圈都 靠下, 而且 如果一整列都没有的话,就都往左靠。。。。思路:比赛的时候没调试完,,,, 最坑爹的是,用后台数据测试都对了,结果还是wrong, 经过鑫哥指导。。。那些字符要以字符串的形式输入,否则会wrong ,后台的原因不知道为什么。。。 1 #include 2 #include 3 #include 4 #include 5 using namespac... 阅读全文
posted @ 2013-12-01 21:35 水门 阅读(338) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.sdut.edu.cn/sdutoj/problem.php?action=showproblem&problemid=2718题意:优先直走,右 左 后。。。。思路:我定义的朝向 已经 d[]的先后次序。。。。。3214 1 #include 2 #include 3 using namespace std; 4 5 int dx[5]={0,1,-1,0,0}; 6 int dy[5]={0,0,0,1,-1}; 7 struct node 8 { 9 int x,y,tow,step; 10 }pos,before; 11 in... 阅读全文
posted @ 2013-12-01 20:41 水门 阅读(323) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1039题意:有一宽度为1的折线管道,上面顶点为(xi,yi),所对应的下面顶点为(xi,yi-1),假设管道都是不透明的,不反射的,光线从左边入口处的(x1,y1),(x1,y1-1)之间射入,向四面八方传播,求解光线最远能传播到哪里(取x... 阅读全文
posted @ 2013-11-25 21:30 水门 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 题目:http://codeforces.com/problemset/problem/135/B题意:给8个点 判断能否用 4个点构成正方形,另外4个点构成 矩形。输出 第一行是正方形 ,第二行是矩形。我的思路:用了4个for循环 枚举四个点, 用向量判断,四个点构成 六条边,如果这六条边里,有四... 阅读全文
posted @ 2013-11-10 19:12 水门 阅读(382) 评论(0) 推荐(0) 编辑
摘要: 题目:http://poj.org/problem?id=1265题意:已知机器人行走步数及每一步的坐标 变化量 ,求机器人所走路径围成的多边形的面积、多边形边上和内部的点的数量。思路:1.以格子点为顶点的线段,覆盖的点的个数为GCD(dx,dy),其中,dxdy分别为线段横向占的点数和纵向占的点... 阅读全文
posted @ 2013-11-07 19:42 水门 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 这个题要交c++, 因为prime的返回值错了,改了一会题目:http://poj.org/problem?id=2031题意:就是给出三维坐标系上的一些球的球心坐标和其半径,搭建通路,使得他们能够相互连通。如果两个球有重叠的部分则算为已连通,无需再搭桥。求搭建通路的最小费用(费用就是边权,就是两个... 阅读全文
posted @ 2013-11-05 20:46 水门 阅读(197) 评论(0) 推荐(0) 编辑
摘要: 题目:http://acm.hdu.edu.cn/showproblem.php?pid=4502思路:一个简单的dp ,比赛时没做出来呢。。。。。d[i]代表 到第i天时的最大值#include#include#include#includeusing namespace std;int main(){ int p[110][110],d[110]; int t,i,j,m,n,s,e,c; cin>>t; while(t--) { memset(p,0,sizeof(p)); memset(d,0,sizeof(d)); ... 阅读全文
posted @ 2013-11-03 21:23 水门 阅读(199) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11 12 13 14 15 ··· 17 下一页