2017年5月28日

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 阅读(276) 评论(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 阅读(386) 评论(0) 推荐(0) 编辑

2017年5月23日

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 阅读(375) 评论(0) 推荐(0) 编辑

2017年5月22日

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 阅读(157) 评论(0) 推荐(0) 编辑

2017年5月21日

最优配对问题(集合上的动态规划) —— 状压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 阅读(800) 评论(0) 推荐(0) 编辑

2017年5月19日

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 阅读(150) 评论(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 阅读(223) 评论(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 阅读(149) 评论(0) 推荐(0) 编辑

2017年5月13日

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 阅读(214) 评论(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 阅读(217) 评论(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 阅读(178) 评论(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 阅读(35467) 评论(0) 推荐(0) 编辑

2017年5月6日

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 阅读(152) 评论(0) 推荐(0) 编辑

2017年5月5日

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 阅读(118) 评论(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 阅读(163) 评论(0) 推荐(0) 编辑

导航