摘要: 欧拉筛法的基本思想 :在埃氏筛法的基础上,让每个合数只被它的最小质因子筛选一次,以达到不重复的目的。 1 #include<iostream> 2 #include<cstring> 3 using namespace std; 4 #define max 100000 5 6 bool visit 阅读全文
posted @ 2020-02-23 11:52 sqdtss 阅读(194) 评论(0) 推荐(0) 编辑
摘要: 1 // 无向图求最小生成树权值Prim算法 2 3 #include <iostream> 4 #include <cstring> 5 using namespace std; 6 #define INF 0x3f3f3f3f 7 int maps[505][505]; 8 bool visit 阅读全文
posted @ 2020-02-23 11:45 sqdtss 阅读(816) 评论(0) 推荐(0) 编辑
摘要: #include <iostream> #include <cstdio> using namespace std; int parent[500]; int find(int x) // 找祖宗函数 { if (parent[x] != x) parent[x] = find(parent[x]) 阅读全文
posted @ 2020-02-23 11:30 sqdtss 阅读(86) 评论(0) 推荐(0) 编辑
摘要: 题目网址:http://acm.hdu.edu.cn/showproblem.php?pid=2955 #include <iostream> #include <algorithm> #include <cstring> using namespace std; int v[100+5]; dou 阅读全文
posted @ 2020-02-23 11:26 sqdtss 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=2546 Problem Description 电子科大本部食堂的饭卡有一种很诡异的设计,即在购买之前判断余额。如果购买一个商品之前,卡上的剩余金额大于或等于5元,就一定可以购买成功(即使购买后卡上余额为 阅读全文
posted @ 2020-02-23 11:24 sqdtss 阅读(206) 评论(0) 推荐(0) 编辑