
Light OJ
JeraKrs
本人目前就职于百度商业研发部,有需要内推的朋友简历可发我邮箱 jerakrs@qq.com
展开
-
LightOJ 1224 - DNA Prefix(字典树)
LightOJ 1224 - DNA Prefix题目大意:给定若干个字符串,找到一个前缀,前缀长度出现次数最大值。解题思路:对字符串集合建立字典树,然后遍历一遍,每个节点等于depval。#include #include #include using namespace std;const int maxn = 50005 * 50;const int sigma原创 2014-10-30 23:36:07 · 1277 阅读 · 0 评论 -
LightOJ 1044 - Palindrome Partitioning(dp)
题目链接:LightOJ 1044 - Palindrome Partitioning代码#include <cstdio>#include <cstring>#include <queue>#include <vector>#include <algorithm>using namespace std;const int maxn = 1005;const int inf = 0x3f原创 2015-11-10 13:05:22 · 653 阅读 · 0 评论 -
LightOJ 1018 - Brush (IV)(记忆化搜索)
题目链接:LightOJ 1018 - Brush (IV)代码#include <cstdio>#include <cstring>#include <queue>#include <algorithm>using namespace std;const int maxn = 17;const int maxs = 1<<17;const int inf = 0x3f3f3f3f;in原创 2015-11-09 20:47:05 · 726 阅读 · 0 评论 -
LightOJ 1025 - The Specials Menu(dp)
题目链接:LightOJ 1025 - The Specials Menu代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 65;typedef long long ll;char s[maxn];ll dp[maxn][maxn];ll solve (原创 2015-11-09 20:49:43 · 688 阅读 · 0 评论 -
LightOJ 1047 - Neighbor House(dp)
题目链接:LightOJ 1047 - Neighbor House代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 30;const int inf = 0x3f3f3f3f;int N, dp[maxn][3];int main () { in原创 2015-11-10 13:06:23 · 551 阅读 · 0 评论 -
LightOJ 1060 - nth Permutation(dp)
题目链接:LightOJ 1060 - nth Permutation代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 30;typedef long long ll;int C[maxn][maxn];char S[maxn];int N, K, c原创 2015-11-10 13:10:29 · 1074 阅读 · 0 评论 -
LightOJ 1050 - Marbles(dp)
题目链接:LightOJ 1050 - Marbles代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 505;int R, B;double dp[maxn][maxn];void init () { memset(dp, 0, sizeof(d原创 2015-11-10 13:07:25 · 752 阅读 · 0 评论 -
LightOJ 1004 - Monkey Banana Problem(dp)
题目链接:LightOJ 1004 - Monkey Banana Problem代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 205;int N, dp[maxn][maxn];int solve () { for (int i = 2; i原创 2015-11-09 20:41:00 · 642 阅读 · 0 评论 -
LightOJ 1027 - A Dangerous Maze(数论)
题目链接:LightOJ 1027 - A Dangerous Maze代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int gcd(int a, int b) { return b == 0 ? a : gcd(b, a%b); }int main () { int cas;原创 2015-11-10 12:44:12 · 529 阅读 · 0 评论 -
LightOJ 1037 - Agent 47(dp)
题目链接:LightOJ 1037 - Agent 47代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = (1<<15) + 5;const int maxm = 20;const int inf = 0x3f3f3f3f;int N, H[maxm],原创 2015-11-10 13:02:54 · 712 阅读 · 0 评论 -
LightOJ 1021 - Painful Bases(dp)
题目链接:LightOJ 1021 - Painful Bases代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 25;const int maxs = 1<<17;typedef long long ll;int base, K;char s[ma原创 2015-11-09 20:48:27 · 565 阅读 · 0 评论 -
LightOJ 1036 - A Refining Company(dp)
题目链接:LightOJ 1036 - A Refining Company代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 505;int N, M, dp[maxn][maxn];int A[maxn][maxn], B[maxn][maxn];//原创 2015-11-10 13:01:57 · 1045 阅读 · 0 评论 -
LightOJ 1033 - Generating Palindromes(dp)
题目链接:LightOJ 1033 - Generating Palindromes代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 105;int N, dp[maxn][maxn];char s[maxn], t[maxn];int solve ()原创 2015-11-10 13:00:52 · 609 阅读 · 0 评论 -
LightOJ 1031 - Easy Game(概率)
题目链接:LightOJ 1031 - Easy Game代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 105;int N, A[maxn], S[maxn], dp[maxn][maxn];bool vis[maxn][maxn];void init原创 2015-11-10 12:58:40 · 732 阅读 · 0 评论 -
LightOJ 1129 - Consistency Checker(字典树)
题目链接:LightOJ 1129 - Consistency Checker题目大意:给定若干个字符串,判断是否存在前缀。解题思路:字典树的简单应用。#include #include #include using namespace std;const int maxn = 10005;const int sigma_size = 10;struct Ti原创 2014-10-30 23:29:52 · 1178 阅读 · 0 评论 -
LightOJ 1269 - Consecutive Sum(字典树)
题目链接:LightOJ 1269 - Consecutive Sum题目大意:给定一个序列,选定一段区间的亦或和,输出最大和最小。解题思路:最大很简单,对所有前缀建立字典树,然后尽量往反向走;最小则需要往正向走,并且向正向走的时候要扣除自己本身。#include #include #include using namespace std;const int原创 2014-10-30 23:59:37 · 1528 阅读 · 0 评论 -
Light OJ 1348 - Aladdin and the Return Journey(树链剖分)
题目链接:Light OJ 1348 - Aladdin and the Return Journey题目大意:给定一棵树,两种操作0 i j:ij路径上的权值和1 i v:将第i个节点的权值修改为v解题思路:树链剖分的裸题。#include #include #include using namespace std;const int maxn = 300原创 2014-10-17 09:46:07 · 1076 阅读 · 0 评论 -
LightOJ 1017 - Brush (III)(dp)
题目链接:LightOJ 1017 - Brush (III)代码#include <cstdio>#include <cstring>#include <vector>#include <algorithm>using namespace std;const int maxn = 105;int N, W, M, G[maxn], Y[maxn];void init () { sc原创 2015-11-09 20:45:41 · 575 阅读 · 0 评论 -
LightOJ 1030 - Discovering Gold(dp)
题目链接:LightOJ 1030 - Discovering Gold代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 105;int N;double dp[maxn], A[maxn];int main () { int cas; s原创 2015-11-10 12:57:16 · 591 阅读 · 0 评论 -
LightOJ 1032 - Fast Bit Calculations(dp)
题目链接:LightOJ 1032 - Fast Bit Calculations代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;const int maxn = 50;ll dp[maxn + 5][maxn + 5][2];int main原创 2015-11-10 12:59:44 · 612 阅读 · 0 评论 -
LightOJ 1057 - Collecting Gold(dp)
题目链接:LightOJ 1057 - Collecting Gold代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 55;const int maxs = 1<<17;const int inf = 0x3f3f3f3f;int N, M, K, X原创 2015-11-10 13:09:30 · 798 阅读 · 0 评论 -
LightOJ 1038 - Race to 1 Again(dp)
题目链接:LightOJ 1038 - Race to 1 Again代码#include <cstdio>#include <cstring>#include <vector>#include <algorithm>using namespace std;const int maxn = 1e5;double dp[maxn + 5];vector<int> G[maxn + 5];vo原创 2015-11-10 13:04:11 · 723 阅读 · 0 评论 -
LightOJ 1005 - Rooks(计数)
题目链接:LightOJ 1005 - Rooks代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;int N, K;ll C(int n, int k) { if (n - k < k) k = n - k; ll ret = 1;原创 2015-11-09 20:42:23 · 525 阅读 · 0 评论 -
LightOJ 1011 - Marriage Ceremonies(dp)
题目链接:LightOJ 1011 - Marriage Ceremonies代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 20;const int maxm = 1<<17;int N, dp[maxn][maxm], W[maxn][maxn];i原创 2015-11-09 20:43:30 · 541 阅读 · 0 评论 -
LightOJ 1013 - Love Calculator(dp)
题目链接:LightOJ 1013 - Love Calculator代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 50;typedef long long ll;int N, M, d[maxn][maxn];char a[maxn], b[max原创 2015-11-09 20:44:34 · 820 阅读 · 0 评论 -
LightOJ 1051 - Good or Bad(dp)
题目链接:LightOJ 1051 - Good or Bad代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 55;int N;char S[maxn];bool dp[maxn][10][10];bool isvowel(char ch) {原创 2015-11-10 13:08:23 · 840 阅读 · 0 评论