摘要: 方法一 由于四位数的素数仅有 \(1061\) 个,因此可以预处理所有的四位素数,每两个素数之间只有一位不同则有边,由此建出一个无向图。预处理后便成了裸的图上 \(bfs\) 。 /** * poj3126 Prime Path * 四位数的素数仅1061个 * prime[169] = 1009, 阅读全文
posted @ 2021-01-22 20:19 Zewbie 阅读(68) 评论(0) 推荐(0)
摘要: 这题直接 \(bfs\) 居然能过是我没想到的。 /** * poj1426 Find The Multiple * */ #include <cstdio> #include <queue> using namespace std; typedef long long LL; LL bfs(int 阅读全文
posted @ 2021-01-22 16:51 Zewbie 阅读(44) 评论(0) 推荐(0)
摘要: 这么简单的暴搜问题也能wa爆心态,我果然还是一如既往的菜。 /** * poj3278 Catch That Cow * bfs */ #include <cstdio> #include <cstring> #include <algorithm> #include <queue> using n 阅读全文
posted @ 2021-01-22 12:47 Zewbie 阅读(57) 评论(0) 推荐(0)
摘要: 一道裸的 \(bfs\) ,然而还是折腾到我了。 /** * hdu1312 Red and Black * bfs */ #include <iostream> #include <cstdio> #include <queue> using namespace std; #define pii 阅读全文
posted @ 2021-01-22 11:15 Zewbie 阅读(80) 评论(0) 推荐(0)
摘要: 一个简单的中缀表达式求值问题,对每一行单独处理,操作数与运算符交替读入处理即可。 #include <iostream> #include <iomanip> #include <sstream> #include <stack> #include <string> using namespace 阅读全文
posted @ 2021-01-22 09:45 Zewbie 阅读(76) 评论(0) 推荐(0)