上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 22 下一页
摘要: Bellman_Ford算法 求图中是否存在负权值的回路 若图中不存在 则最短路最多经过n-1个结点 若经过超过n-1个节点 则存在负权值的回路 此图永远无法找到最短路 每条边最多经过n-1次松弛~~#include#include#include#includeusing namespac... 阅读全文
posted @ 2013-08-18 16:48 xlc2845 阅读(120) 评论(0) 推荐(0)
摘要: 当一个数大于等于12 那分别处以2, 3, 4之后的和一定大于本身 但是直接递归会超时 然后发现有人用map存了 膜拜.....#include #include #include using namespace std;map d;long long cc(int x){ if(x <... 阅读全文
posted @ 2013-08-18 15:48 xlc2845 阅读(120) 评论(0) 推荐(0)
摘要: 求两个圆相交部分的面积#include #include #include #define pi acos(-1.0)struct node{ double x; double y; double r;} c[2];double area(int i, double r1, int... 阅读全文
posted @ 2013-08-18 10:53 xlc2845 阅读(197) 评论(0) 推荐(0)
摘要: 求逆序数对 归并排序 #include #include #include #include using namespace std;int a[71010], b[71010];long long cnt;void merge_sort(int *A, int x, int y, int *T)... 阅读全文
posted @ 2013-08-17 17:24 xlc2845 阅读(136) 评论(0) 推荐(0)
摘要: 总是拆最短的链子 连接长的链子 贪心....#include #include #include #include using namespace std;int a[110];int main(){ int n; scanf("%d",&n); for(int i = 0; i... 阅读全文
posted @ 2013-08-17 17:21 xlc2845 阅读(118) 评论(0) 推荐(0)
摘要: ford 超时 使用优先队列的Dijkstra 算法//#include //#include //#include //#define INF 500000000//using namespace std;//int a[20010][20010];//int main()//{// int... 阅读全文
posted @ 2013-08-17 17:14 xlc2845 阅读(137) 评论(0) 推荐(0)
摘要: 因为一个小错 不过 好不爽........#include #include using namespace std;struct Node{ int x, y;};class shap{public: int num; Node dian[22];} q[22];double g... 阅读全文
posted @ 2013-08-16 19:11 xlc2845 阅读(88) 评论(0) 推荐(0)
摘要: 数组开小了 还RE了一遍....... 最小生成树 按费用从小到大排。。。#include #include #include #include #include #include using namespace std;int n, m, s, p[300000];struct node{ ... 阅读全文
posted @ 2013-08-15 20:39 xlc2845 阅读(118) 评论(0) 推荐(0)
摘要: dp 只有三个操作 当str[i] != str[j] 时 dp(i, j) = min(dp(i+1, j), dp(i+1, j-1), dp(i, j-1))#include #include #include #include #include using namespace std;cha... 阅读全文
posted @ 2013-08-15 19:39 xlc2845 阅读(112) 评论(0) 推荐(0)
摘要: 将c串从a,b串中删去后求最长公子列 直接暴会超时#include #include #include #include using namespace std;char a[1010],b[1010],c[1010];int dp1[1010][1010],dp2[1010][1010];int ... 阅读全文
posted @ 2013-08-15 18:56 xlc2845 阅读(138) 评论(0) 推荐(0)
上一页 1 ··· 10 11 12 13 14 15 16 17 18 ··· 22 下一页