poj
Fearain
一点浩然正气,千里快哉风。
展开
-
poj3187 Backward Digit Sums
额。。原本是想从下标1开始全排列的,但我忘了next_permutation()是从下标0开始的了。。。。 #include #include #include using namespace std; int n, t, res[12][12], f; int main() { while (cin>>n>>t) { memset(res, 0, siz原创 2016-11-10 09:27:12 · 280 阅读 · 0 评论 -
poj 3050 Hopscotch
这道题我是用一棵高度为 6 的树来存储路径,每一个叶子节点表示一条不同的路径,第k层就表示第k步,每生成一条路径,就从树的根部开始查找,若在第 i 层没有找到该路径下的第 i 步的数字,便添加进树的第 i 层中 #include #include #include #include using namespace std; typedef struct Node{ int v,原创 2016-11-10 11:40:56 · 377 阅读 · 0 评论 -
poj 1979 Red and Black
#include #include #include using namespace std; typedef struct Node { int x, y; }Node; int main() { int m, n, si, sj; int dir[4][2] = {0, 1, 0, -1, 1, 0, -1, 0}; char g[21][21];原创 2016-11-20 16:00:06 · 280 阅读 · 0 评论 -
poj 1061 青蛙的约会
#include using namespace std; typedef long long LL; LL ex_gcd(LL a, LL b, LL &x, LL &y) { if (b == 0) { x = 1; y = 0; return a; } LL ans = ex_gcd(b, a%b, x, y原创 2016-11-20 14:59:24 · 320 阅读 · 0 评论 -
poj 2352 Stars
#include #include #include #include #include using namespace std; int n, levels[32005], c[32005]; int lowbit(int x) { return x & (-x); } int sum(int x) { int s = 0; while (x > 0) {原创 2016-11-20 20:58:11 · 206 阅读 · 0 评论 -
poj 3641 Pseudoprime numbers
#include #include #include #include #include using namespace std; typedef long long int ll;//好吧,这次是因为没有使用long long。。。。 ll mod_pow(ll x, ll n, ll mod) { ll res = 1; while (n > 0) {原创 2016-11-26 18:24:12 · 367 阅读 · 0 评论