上一页 1 ··· 3 4 5 6 7 8 9 下一页
摘要: 同样是重载了运算符<的结构体,使用不同的容器或算法,会有一些差别,主要是优先队列。 #include <cstdio> #include <vector> #include <queue> #include <algorithm> #include <set> using namespace std 阅读全文
posted @ 2015-12-26 02:50 tan90丶 阅读(854) 评论(0) 推荐(0) 编辑
摘要: 1.素数线性筛核心 结论:每一个数都用它的最大素因子将这个合数筛掉。 (27用9筛 15用5筛) 理解:合数一定有因子,既然是几个数,就一定有最大的一个。最大因子是唯一的,所以合数只会被它自己唯一的最大因子筛掉一次。 2.如何通过一个数筛去以该数为最大因子的合数 结论1:设a是b的最大因子,则b必然 阅读全文
posted @ 2015-12-24 22:33 tan90丶 阅读(223) 评论(0) 推荐(0) 编辑
摘要: HDU 2081 手机短号 /* HDU 2081 手机短号 */ #include <cstdio> int main() { int n; char a[15]; scanf("%d", &n); while (n--){ scanf("%s", a); printf("6%s\n", a + 阅读全文
posted @ 2015-12-24 21:52 tan90丶 阅读(175) 评论(0) 推荐(0) 编辑
摘要: HDU 2093 考试排名 /* HDU 2093 考试排名 */ #include <cstdio> #include <string> #include <queue> #include <iostream> using namespace std; struct Node{ string na 阅读全文
posted @ 2015-12-24 21:47 tan90丶 阅读(247) 评论(0) 推荐(0) 编辑
摘要: /* HDU 2094 产生冠军 */ /* 这到题测试数据应该有错误 参考网上的代码 说是满足总人数-失败者=1即可以 这样做也确实可以AC 但下面的数据应该是无法判断出冠军的 但用上面的思路是算可以的 因此 我也不知道怎么办才好 AC了再说 A B B c D E E F F D */ #inc 阅读全文
posted @ 2015-12-24 20:12 tan90丶 阅读(233) 评论(0) 推荐(0) 编辑
摘要: HDU 2091 空心三角形 /* HDU 2091 空心三角形 水题 */ #include <cstdio> int main() { int kase = 0; char ch; int h, t; //h表示高 while (scanf("%c", &ch) == 1 && ch != '@ 阅读全文
posted @ 2015-12-22 03:41 tan90丶 阅读(151) 评论(0) 推荐(0) 编辑
摘要: HDU 2089 不要62 /* HDU 2089 不要62 水题+打表 */ #include <cstdio> #include <cstring> const int maxn = 1000005; bool a[maxn]; int main() { memset(a, 0, sizeof 阅读全文
posted @ 2015-12-22 03:11 tan90丶 阅读(127) 评论(0) 推荐(0) 编辑
摘要: HDU 2090 算菜价 /* HDU 2090 算菜价 水题 */ #include <cstdio> int main() { char s[105]; double a, b, sum = 0; while (scanf("%s", s)==1){ scanf("%lf%lf", &a, &b 阅读全文
posted @ 2015-12-22 02:46 tan90丶 阅读(213) 评论(0) 推荐(0) 编辑
摘要: HDU 2092 整数解 x+y = n, x*y = m; y = n - x; x * ( n - x) = m nx - x^2 = m; x^2 - nx + m = 0; △ = sqrt(n^2 - 4m) 要有整数解即△需要为可开方数即可。 /* HDU 2092 整数解 水题 */ 阅读全文
posted @ 2015-12-22 02:33 tan90丶 阅读(167) 评论(0) 推荐(0) 编辑
摘要: HDU 1016 题意:输入一个数n,把1到n的自然数放到一个环里(第一个为1),保证相邻的两个数的和是素数。 思路:第一个数填1,以后每个数判断该数和前一个数想加是否为素数,是则填,然后标记,近一步递归求解。 然后记得回溯,继续判断下一个和前一个数之和为素数的数。素数需要打表 /* HDU 101 阅读全文
posted @ 2015-12-19 02:25 tan90丶 阅读(155) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7 8 9 下一页