2015-2016 ACM-ICPC, NEERC, Northern Subregional Contest D Problem D. Distribution in Metagonia Input file: distribution.in Output file: distribution.out Time limit: 2 seconds Memory limit: 256 megabytes There are one hundred noble families in the cou…
1009 I am your Father! (最小树形图-朱刘算法) 题目链接 HDU6141 I am your Father! 求有向图最大生成树,要求n的父节点尽量小. 我们将所有wi变为-wi,这题就变成了有向图最小生成树的模板题.对于f(n)尽可能小的要求,可以令所有wi扩大1000倍,然后 对于yi=n的点将1000-xi计入wi中,这样就保证了在W尽可能大的情况下f(n)尽可能小.有向图最小生成树的部分我们可以 O(nm)解决,大体思路是先找到每个点边权最小的父向边,然后这样连边…
1002 Build a tree(递归) 题目链接 HDU6121 Build a tree 有一棵n个点的有根树,标号为0到n-1,i号点的父亲是\(\lfloor\frac{i-1}{k}\rfloor\)号点,求所有子树大小的异或和.\(1\leq n,k\leq10^{18}\). 找出n所在的链,然后从根开始递归处理. k=1的时候特判,1异或到n,每4个异或起来为0. #include<bits/stdc++.h> #define ll long long using names…
1001 Add More Zero(签到题) 题目链接 HDU6033 Add More Zero 找出最大的k,使得\(2^m-1\ge 10^k\). 直接取log,-1可以忽略不计. #include <cstdio> #include <cmath> int cas,m; int main(){ while(~scanf("%d",&m)){ printf("Case #%d: %d\n",++cas,(int)(m*log…
题目链接 https://acm.bnu.edu.cn/v3/contest_show.php?cid=8506#problem/A problem description As we know, the NTU Final PK contest usually tends to be pretty hard. Many teams got frustrated when participating NTU Final PK contest. So I decide to make the fi…
ZCC Loves Codefires Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 790 Accepted Submission(s): 420 Problem Description Though ZCC has many Fans, ZCC himself is a crazy Fan of a coder, called…
Couple doubi Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1087 Accepted Submission(s): 762 Problem Description DouBiXp has a girlfriend named DouBiNan.One day they felt very boring and dec…
Balala Power! Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 3757 Accepted Submission(s): 907 Problem Description Talented Mr.Tang has n strings consisting of only lower case characters. H…
Function Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 273 Accepted Submission(s): 99 Problem Description You are given a permutation a from 0 to n−1 and a permutation b from 0 to m−1. De…
Nice boat Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 47 Accepted Submission(s): 10 Problem Description There is an old country and the king fell in love with a devil. The devil always ask…
Hotaru's problem Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 907 Accepted Submission(s): 322 Problem Description Hotaru Ichijou recently is addicated to math problems. Now she is playing…
The shortest problem Time Limit: 3000/1500 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 346 Accepted Submission(s): 167 Problem Description In this problem, we should solve an interesting game. At first, we hav…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=6331 Walking Plan Problem Description There are n intersections in Bytetown, connected with m one way streets. Little Q likes sport walking very much, he plans to walk for q days. On the i -th day, Little…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=6325 Interstellar Travel Problem Description After trying hard for many years, Little Q has finally received an astronaut license. To celebrate the fact, he intends to buy…
链接:http://acm.hdu.edu.cn/showproblem.php?pid=6322 Problem Description In number theory, Euler's totient function φ(n) counts the positive integers up to a given integer n that are relatively prime to n . It can be defined more formally as the number…
题目链接 https://acm.bnu.edu.cn/v3/problem_show.php?pid=52310 problem description Define the depth of a node in a rooted tree by applying the following rules recursively: • The depth of a root node is 0. • The depths of child nodes whose parents are with…
题目链接 https://acm.bnu.edu.cn/v3/problem_show.php?pid=52305 problem description In ICPCCamp, there are n cities and (n−1) (bidirectional) roads between cities. The i-th road is between the ai-th and bi-th cities. It is guaranteed that cities are conne…