上一页 1 ··· 5 6 7 8 9 10 11 下一页
摘要: 1 #include 2 using namespace std; 3 int MOD; 4 5 int fast_pow_mod(int a, int b) { 6 int res = 1; 7 while(b) { 8 if (b & 1) res = res * a % MOD; 9 a = a * a % MOD; 10... 阅读全文
posted @ 2017-02-01 01:54 Robin! 阅读(851) 评论(0) 推荐(0) 编辑
摘要: 最简单的记忆化搜索,题目有点问题,a, b, c中若既满足其中一个不大于0,又满足其中一个大于20,按前一种情况。 Code: 1 #include<bits/stdc++.h> 2 using namespace std; 3 int w[21][21][21]; 4 5 int dfs(int 阅读全文
posted @ 2017-01-28 19:27 Robin! 阅读(173) 评论(0) 推荐(0) 编辑
摘要: 经典的字典树,debug爽歪歪。 Code: 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int MAXN = 500000; 4 int ch[MAXN][26], tag[MAXN], tot = 1; 5 char word 阅读全文
posted @ 2017-01-26 23:24 Robin! 阅读(136) 评论(0) 推荐(0) 编辑
摘要: 简单并查集 Code 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int MAXN = 10000 + 10; 4 const int dx[] = {1, -1, 0, 0, 1, -1, 1, -1}; 5 const int 阅读全文
posted @ 2017-01-23 14:28 Robin! 阅读(201) 评论(0) 推荐(0) 编辑
摘要: 1 #include<bits/stdc++.h> 2 using namespace std; 3 #define MAXN 1000+10 4 int dp[MAXN][MAXN], a[MAXN]; 5 6 void InitRMQ(int l, int r, int n){ 7 int k 阅读全文
posted @ 2017-01-22 21:29 Robin! 阅读(139) 评论(0) 推荐(0) 编辑
摘要: Description FJ has purchased N (1 <= N <= 2000) yummy treats for the cows who get money for giving vast amounts of milk. FJ sells one treat per day an 阅读全文
posted @ 2017-01-22 21:15 Robin! 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Problem Description Nowadays, a kind of chess game called “Super Jumping! Jumping! Jumping!” is very popular in HDU. Maybe you are a good boy, and kno 阅读全文
posted @ 2017-01-21 13:04 Robin! 阅读(68) 评论(0) 推荐(0) 编辑
摘要: 思路: 如果只判断子串是否有13的话非常简单,这题还加了一个条件就是要被13整除; 这里就要用到模运算的性质,即(a+b+c)%d = (a%d + b%d + c%d)%d。 Code: 1 #include<bits/stdc++.h> 2 #define M(a, b) memset(a, b 阅读全文
posted @ 2017-01-20 22:44 Robin! 阅读(108) 评论(0) 推荐(0) 编辑
摘要: Problem Description Ignatius is so lucky that he met a Martian yesterday. But he didn’t know the language the Martians use. The Martian gives him a hi 阅读全文
posted @ 2017-01-13 20:26 Robin! 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 题目: Ignatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input 输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计 阅读全文
posted @ 2017-01-13 11:53 Robin! 阅读(133) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 下一页