- 博客(26)
- 收藏
- 关注
原创 hdu 5593 ZYB's Tree(树形dp)
题目链接:hdu 5593 ZYB’s Tree代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 500005;int N, K, E, first[maxn], jump[maxn], linker[maxn];int ans, dp[maxn][15]
2015-12-26 22:21:49 1019
原创 hdu 5592 ZYB's Premutation(线段树)
题目链接:hdu 5592 ZYB’s Premutation代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 50005;#define lson(x) ((x)<<1)#define rson(x) (((x)<<1)|1)int lc[maxn<<
2015-12-26 22:18:35 800
原创 hdu 5591 ZYB's Game(水)
题目链接:hdu 5591 ZYB’s Game代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int main () { int cas, n; scanf("%d", &cas); while (cas--) { scanf("%d", &n);
2015-12-26 22:15:27 767
原创 hdu 5590 ZYB's Biology(水)
题目链接:hdu 5590 ZYB’s Biology代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 105;bool judge (char a, char b) { if (a == 'A' && b == 'U') return true;
2015-12-26 22:12:00 1212
原创 hdu 5602 Black Jack(dp)
题目链接:hdu 5602 Black Jack解题思路dp[i][j]表示闲家为i时,庄家为j时,庄家可以操作的情况下输掉的概率 f[i][j]表示闲家为i,庄家为j,闲家可以继续操作的情况下,胜出的可能 f[i][j]的转移要用到dp[i][j],对于每个状态来说,取不填牌和填牌后中概率最大的 dp[i][j]等于是闲家不再填牌后,闲家胜的概率代码#include <cstdio>#in
2015-12-26 22:10:30 1018
原创 hdu 5601 N*M bulbs(规律)
题目链接:hdu 5601 N*M bulbs代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;int main () { int n, m, s, cas; scanf("%d", &cas); while (cas--) { scanf("%d%d"
2015-12-26 22:05:35 1061
原创 Codeforces 601D Acyclic Organic Compounds(dfs+字典树合并)
题目链接:Codeforces 601D Acyclic Organic Compounds代码#include <cstdio>#include <cstring>#include <vector>#include <algorithm>using namespace std;const int maxn = 300005;const int SIGMA_SIZE = 26;typed
2015-12-03 21:34:51 1102
原创 Codeforces 601C Kleofáš and the n-thlon(dp)
题目链接:Codeforces 601C Kleofáš and the n-thlon解题思路dp[i][j]表示到第i场比赛时,得分为j的人数期望。dp[i][j] = sum { dp[i-1][j-x] ~ dp[i-1][j-x] | 1 ≤ x ≤ m && x != rank[i] }代码#include <cstdio>#include <cstring>#include <al
2015-12-03 21:33:27 976
原创 Codeforces 601B Lipshitz Sequence(高效)
题目链接:Codeforces 601B Lipshitz Sequence代码#include <cstdio>#include <cstring>#include <cstdlib>#include <algorithm>using namespace std;const int maxn = 1e5 + 5;typedef long long ll;int N, M, A[maxn]
2015-12-03 21:27:49 1009
原创 Codeforces 601A The Two Routes(暴力)
题目链接:Codeforces 601A The Two Routes代码#include <cstdio>#include <cstring>#include <queue>#include <algorithm>using namespace std;const int maxn = 405;const int inf = 0x3f3f3f3f;int N, M, G[maxn][ma
2015-12-03 21:21:36 987
原创 Codeforces 602B Approximating a Constant Range(RMQ)
题目链接:Codeforces 602B Approximating a Constant Range代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 100005;const int maxm = 20;int N, A[maxn], mx[maxn][
2015-12-03 21:18:01 620
原创 Codeforces 602A Two Bases(水)
题目链接:Codeforces 602A Two Bases代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef long long ll;ll getnumber () { int n, k, a; ll ret = 0; scanf("%d%d", &
2015-12-03 21:14:58 725
原创 uva 1077 - The Sky is the Limit(离散化)
题目链接:uva 1077 - The Sky is the Limit代码#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>using namespace std;const int maxn = 200005;const double eps = 1e-8;struct Point {
2015-12-03 21:12:59 1361
原创 hdu 5587 Array(高效)
题目链接:hdu 5587 Array代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 55;typedef unsigned long long ll;ll N, cnt[maxn+5], sum[maxn+5];ll solve (ll n) {
2015-12-03 21:07:25 621
原创 hdu 5586 Sum(水)
题目链接:hdu 5586 Sum代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 1e5 + 5;const int mod = 10007;int N, A[maxn];int main () { while (scanf("%d", &N)
2015-12-03 21:06:14 665
原创 hdu 5585 Numbers(水)
题目链接:hdu 5585 Numbers代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 105;char str[maxn];bool judge () { int n = strlen(str) - 1; int d = str[n]
2015-12-03 21:04:46 521
原创 hdu 5584 LCM Walk(规律)
题目链接:hdu 5584 LCM Walk代码#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; scanf("%d
2015-12-03 21:02:50 1271
原创 hdu 5583 Kingdom of Black and White(高效)
题目链接:hdu 5583 Kingdom of Black and White代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 1e5 + 5;typedef long long ll;char str[maxn];int L[maxn][2], R[
2015-12-03 21:00:28 803
原创 hdu 5578 Friendship of Frog(水)
题目链接:hdu 5578 Friendship of Frog代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 1005;const int inf = 0x3f3f3f3f;char str[maxn];int main () { int ca
2015-12-03 20:59:09 825
原创 hdu 5573 Binary Tree(构造)
题目链接:hdu 5573 Binary Tree代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;typedef unsigned long long ll;int main () { int cas; scanf("%d", &cas); for (int kca
2015-12-03 20:57:54 886
原创 hdu 5572 An Easy Physics Problem(几何)
题目链接:hdu 5572 An Easy Physics Problem解题思路注意精度误差,发射的情况可以对应求出B点的对称点再判断代码#include <cstdio>#include <cstring>#include <cmath>#include <algorithm>using namespace std;const double eps = 1e-8;const doubl
2015-12-03 20:56:43 2237
原创 hdu 5570 balls(高效)
题目链接:hdu 5570 balls代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 1005;int N, M;double A[maxn][maxn];int main () { while (scanf("%d%d", &N, &M) ==
2015-12-03 20:54:25 554
原创 hdu 5569 matrix(dp)
题目链接:hdu 5569 matrix代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 1005;const int inf = 0x3f3f3f3f;int N, M, A[maxn][maxn], dp[maxn][maxn];int solve (
2015-12-03 20:53:05 586
原创 hdu 5568 sequence2(dp + 大数)
题目链接:hdu 5568 sequence2代码#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int maxn = 105;struct Bign { int n, s[maxn<<1]; Bign (int t = 0) { init(); s[0] = t;
2015-12-03 20:51:33 649
原创 hdu 5567 sequence1(水)
题目链接:hdu 5567 sequence1代码#include <cstdio>#include <cstring>#include <cstdlib>#include <algorithm>using namespace std;const int maxn = 105;int main () { int n, a[maxn], b, c; while (scanf("
2015-12-03 20:49:41 627
原创 hdu 5409 CRB and Graph(强连通)
题目链接:hdu 5409 CRB and Graph代码#include <cstdio>#include <cstring>#include <vector>#include <algorithm>using namespace std;const int maxn = 1e5 + 5; // The number of Nodeconst int maxm = 1e5 + 5; //
2015-12-03 20:48:15 921
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人