05 2017 档案

HDU4850 Wow! Such String! —— 字符串构造
摘要:题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4850 代码如下: 1 #include <iostream> 2 #include <cstdio> 3 #include <cstring> 4 #include <cstdlib> 5 #inclu 阅读全文

posted @ 2017-05-31 19:01 h_z_cong 阅读(156) 评论(0) 推荐(0)

Codeforces Round #376 (Div. 2) A. Night at the Museum —— 循环轴
摘要:题目链接: http://codeforces.com/contest/731/problem/AA. Night at the Museumtime limit per test1 secondmemory limit per test256 megabytesin... 阅读全文

posted @ 2017-05-31 16:14 h_z_cong 阅读(528) 评论(0) 推荐(0)

Codeforces Round #376 (Div. 2) C. Socks —— 并查集 + 贪心
摘要:题目链接:http://codeforces.com/contest/731/problem/C 题解: 1.看题目时,大概知道,不同的袜子会因为要在同一天穿而差生了关联(或者叫相互制约), 其中一条袜子可以穿多次或者不穿。那么自然就想到用并查集(DSU), 把有关联的袜子放在一个集合(经过处理后, 阅读全文

posted @ 2017-05-31 15:37 h_z_cong 阅读(222) 评论(0) 推荐(0)

UVA1635 Irrelevant Elements —— 唯一分解定理 + 二项式定理
摘要:题目链接:https://vjudge.net/problem/UVA-1635 (紫书320) 题解: 1.根据二项式定理, 可得递推公式: C(n,k) = (n-k+1)/k * C(n, k-1) 2.某一项与余数(%m)无关, 即表明该项的的系数是m的倍数, 由于 1<=n<=1e5, 直 阅读全文

posted @ 2017-05-28 15:28 h_z_cong 阅读(297) 评论(0) 推荐(0)

poj3904 Sky Code —— 唯一分解定理 + 容斥原理 + 组合
摘要:题目链接:http://poj.org/problem?id=3904 Sky Code Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 2968 Accepted: 998 Description Stancu likes sp 阅读全文

posted @ 2017-05-28 10:56 h_z_cong 阅读(406) 评论(0) 推荐(0)

poj2773 —— 二分 + 容斥原理 + 唯一分解定理
摘要:题目链接:http://poj.org/problem?id=2773 Happy 2006 Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 12942 Accepted: 4557 Description Two positiv 阅读全文

posted @ 2017-05-23 23:03 h_z_cong 阅读(401) 评论(0) 推荐(0)

CSU 1554 SG Value —— 思维
摘要:题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1554DescriptionThe SG value of a set (multiset) is the minimum positive intege... 阅读全文

posted @ 2017-05-22 21:18 h_z_cong 阅读(165) 评论(0) 推荐(0)

最优配对问题(集合上的动态规划) —— 状压DP
摘要:题目来源:紫书P284题意:给出n个点的空间坐标(n为偶数, n#include #include using namespace std;const int INF = 2e9;const int maxn = 21;struct Node{ double x... 阅读全文

posted @ 2017-05-21 09:29 h_z_cong 阅读(910) 评论(0) 推荐(0)

Codeforces Round #374 (Div. 2) D. Maxim and Array —— 贪心
摘要:题目链接:http://codeforces.com/problemset/problem/721/DD. Maxim and Arraytime limit per test2 secondsmemory limit per test256 megabytesinp... 阅读全文

posted @ 2017-05-19 22:13 h_z_cong 阅读(159) 评论(0) 推荐(0)

Codeforces Round #373 (Div. 2) C. Efim and Strange Grade —— 贪心 + 字符串处理
摘要:题目链接:http://codeforces.com/problemset/problem/719/C C. Efim and Strange Grade time limit per test 1 second memory limit per test 256 megabytes input s 阅读全文

posted @ 2017-05-19 22:08 h_z_cong 阅读(235) 评论(0) 推荐(0)

Codeforces Round #369 (Div. 2) D. Directed Roads —— DFS找环 + 快速幂
摘要:题目链接:http://codeforces.com/problemset/problem/711/D D. Directed Roads time limit per test 2 seconds memory limit per test 256 megabytes input standard 阅读全文

posted @ 2017-05-19 21:58 h_z_cong 阅读(174) 评论(0) 推荐(0)

Codeforces Round #374 (Div. 2) C. Journey —— DP
摘要:题目链接:http://codeforces.com/contest/721/problem/C C. Journey time limit per test 3 seconds memory limit per test 256 megabytes input standard input out 阅读全文

posted @ 2017-05-13 15:33 h_z_cong 阅读(226) 评论(0) 推荐(0)

Codeforces Round #363 (Div. 2) D. Fix a Tree —— 并查集
摘要:题目链接:http://codeforces.com/contest/699/problem/D D. Fix a Tree time limit per test 2 seconds memory limit per test 256 megabytes input standard input 阅读全文

posted @ 2017-05-13 15:22 h_z_cong 阅读(232) 评论(0) 推荐(0)

Codeforces Round #374 (Div. 2) B. Passwords —— 基础题
摘要:题目链接:http://codeforces.com/contest/721/problem/BB. Passwordstime limit per test2 secondsmemory limit per test256 megabytesinputstandar... 阅读全文

posted @ 2017-05-13 14:58 h_z_cong 阅读(202) 评论(0) 推荐(0)

Codeforces Round #374 (Div. 2) A. One-dimensional Japanese Crossword —— 基础题
摘要:题目链接:http://codeforces.com/contest/721/problem/AA. One-dimensional Japanese Crosswordtime limit per test1 secondmemory limit per test2... 阅读全文

posted @ 2017-05-13 14:05 h_z_cong 阅读(41078) 评论(0) 推荐(0)

UVA10129 Play on Words —— 欧拉回路
摘要:题目链接:https://vjudge.net/problem/UVA-10129代码如下:// UVa10129 Play on Words// Rujia Liu// 题意:输入n个单词,是否可以排成一个序列,使得每个单词的第一个字母和上一个单词的最后一个字母相同... 阅读全文

posted @ 2017-05-06 16:11 h_z_cong 阅读(167) 评论(0) 推荐(0)

Codeforces Round #363 (Div. 2) B. One Bomb —— 技巧
摘要:题目链接:http://codeforces.com/contest/699/problem/B题解:首先统计每行每列出现‘*’的次数,以及‘*’出现的总次数,得到r[n]和c[m]数组,以及sum,。然后再枚举每一个格子(O(n^2)枚举,反正输入都是枚举的)。对于... 阅读全文

posted @ 2017-05-05 19:37 h_z_cong 阅读(124) 评论(0) 推荐(0)

Codeforces Round #363 (Div. 2) C. Vacations —— DP
摘要:题目链接:http://codeforces.com/contest/699/problem/C题解:1.可知每天有三个状态:1.contest ,2.gym,3.rest。2.所以设dp[i][j](i:1~n,j:1~3)为第i天进行j活动的最小休息天数。3.状态... 阅读全文

posted @ 2017-05-05 19:13 h_z_cong 阅读(172) 评论(0) 推荐(0)

Codeforces Round #373 (Div. 2) Anatoly and Cockroaches —— 贪心
摘要:题目链接:http://codeforces.com/contest/719/problem/BB. Anatoly and Cockroachestime limit per test1 secondmemory limit per test256 megabyte... 阅读全文

posted @ 2017-05-04 21:48 h_z_cong 阅读(173) 评论(0) 推荐(0)

UVA1025 A Spy in the Metro —— DP
摘要:题目链接: https://vjudge.net/problem/UVA-1025题解:详情请看紫书P267。 与其说是DP题,我觉得更像是模拟题,特别是用记忆化搜索写。递推:#include #include #include #include #include #... 阅读全文

posted @ 2017-05-01 22:51 h_z_cong 阅读(183) 评论(0) 推荐(0)

SCUT125 华为杯 D.笔芯回文 —— DP
摘要:题目链接: https://scut.online/p/125 题目描述 bxbx有一个长度一个字符串SS,bxbx可以对其进行若干次操作。 每次操作可以删掉一个长度为k(1 \leq k \leq n)k(1≤k≤n)的连续回文子串,bxbx获得a_ka​k​​的愉悦值。 一个字符串是回文串当且仅 阅读全文

posted @ 2017-05-01 16:08 h_z_cong 阅读(225) 评论(0) 推荐(0)

NYOJ-37 回文字符串 —— LCS变形
摘要:题目链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=37 题解: 一开始想从两边向中间添加字符,发现这样不是最优的。因为加入字符之后,这些原本存在的字符是离散的,所以就不能用顺序的方法去添加。 正确做法是将字符串逆过来,与原字符串求最大公共子序 阅读全文

posted @ 2017-05-01 10:00 h_z_cong 阅读(144) 评论(0) 推荐(0)

导航