Y sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 667    Accepted Submission(s): 147 Problem Description Yellowstar likes integers so much that he listed all positive integers in ascend…
题意: t组测试数据,每组数据有 n 个只由 '(' 和 ')' 构成的括号串. 要求把这 n 个串排序然后组成一个大的括号串,使得能够匹配的括号数最多. 如()()答案能够匹配的括号数是 4,(()) 也是 4. 例如: n = 2 ) )(( 你可以将其排序为))((,数目为0,也可以将其排序为)((),数目为1. 解法: 贪心. 把所有字符串中本身能够匹配的括号全部去掉,然后剩下的字符串只有三种: 1.全是 '(' 2.全是 ')' 3.一串 ')' 加一串 '(' 对于每一种字符串,如果…
http://acm.hdu.edu.cn/showproblem.php?pid=6304 题意 给出一个数列的定义,a[1]=a[2]=1,a[n]=a[n-a[n-1]]+a[n-1-a[n-2]](n>=3).求前n项和,n<=1e18. 分析 一看就是得打表找规律或推公式的题目. 先把a[i]打出来: 1 1 2 2 3 4 4 4 5 6 6... 乍眼一看每个数字出现的次数有点意思,于是打出每个数出现次数: 数值   1  2  3  4  5  6  7  8  9  10 …
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6299 题目: 题意:t组数据,每组数据给你一个n表示给你n个括号串,这n个括号串之间进行组合,求能够匹配的长度. 思路:用一个结构体来记录每个字符串的左括号和右括号的数量,在输入时将同串中能够匹配的直接消掉,最后剩余的字符绝对是所有的右括号在左边,左括号在右边,假设当前字符串为())(()(,我们一次将其标记为1~7,那么1和2可以匹配,5可以和6匹配,最后剩余347,也就是)((.我们紧接着就对n…
Y sequence Problem's Link: http://acm.hdu.edu.cn/showproblem.php?pid=5297 Mean: 有连续数列A={1,2,3,4,5,6,7,8 .....},将可以表示成a^b次方的数删除,a={1,2,3,4,5...},而2<=b<=r,删除后形成一个新的数列,求这个数列的第n项. analyse: 很有趣的一道数论题. 对于给定的一个n,如果我们知道1~n中被删除的数字为k个,那么答案一定大于等于n+k,所以向后至少移动k个…
Gorgeous Sequence Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 349    Accepted Submission(s): 57 Problem Description There is a sequence a of length n. We use ai to denote the i-th element…
OO's Sequence                                                          Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)                                                                                             T…
Easy Sequence Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 766    Accepted Submission(s): 208 Problem Descriptionsoda has a string containing only two characters -- '(' and ')'. For every c…
OO’s Sequence Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 312    Accepted Submission(s): 107 Problem Description OO has got a array A of size n ,defined a function f(l,r) represent the num…
tree Time Limit: 8000ms Memory Limit: 262144KB This problem will be judged on HDU. Original ID: 539064-bit integer IO format: %I64d      Java class name: Main   Given a rooted tree(node 1 is the root) with n nodes. The ithnode has a positive value vi…
Magician Time Limit: 18000/9000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 543    Accepted Submission(s): 151 Problem Description Fantasy magicians usually gain their ability through one of three usual methods:…
2015 Multi-University Training Contest 1 A.OO's Sequence 计算每个数的贡献 找出第\(i\)个数左边最靠右的因子位置\(lp\)和右边最靠左的因子位置\(rp\) 对答案的贡献就是\((rp-i)*(i-lp)\) 最后答案就是\(\sum_{i=1}^{n}(rp_i-i)*(i-lp_i)\) 预处理出来所有的因子,复杂度\(O(n\sqrt{10000})\) //#pragma GCC optimize("O3") //#…
Root Time Limit: 30000/15000 MS (Java/Others)    Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 34    Accepted Submission(s): 6 Problem Description Given a number sum(1≤sum≤100000000),we have m queries which contains a pair (xi,yi) a…
CRB and Tree                                                             Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)                                                                                            To…
CRB and Queries Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 533    Accepted Submission(s): 125 Problem DescriptionThere are N boys in CodeLand.Boy i has his coding skill Ai.CRB wants to k…
Leader in Tree Land Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 447    Accepted Submission(s): 185 Problem DescriptionTree land has n cities, connected by n−1 roads. You can go to any city f…
Expression Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 175    Accepted Submission(s): 95 Problem Description Teacher Mai has n numbers $a_1,a_2,\dots,a_n$ and $n-1$ operators ("+","…
The sum of gcd Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 641    Accepted Submission(s): 277 Problem Description  You have an array A with the length of $n$ \[Let\quad f(l,r) = \sum_{i = l}…
Yu-Gi-Oh! Time Limit: 2000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ID: 538364-bit integer IO format: %I64d      Java class name: Main   "Yu-Gi-Oh!", also known as "Dueling Monsters", is a popular trading ca…
The path Time Limit: 2000ms Memory Limit: 65536KB This problem will be judged on HDU. Original ID: 538564-bit integer IO format: %I64d      Java class name: Main Special Judge   You have a connected directed graph.Let d(x) be the length of the shorte…
Zero Escape Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 407    Accepted Submission(s): 190 Problem Description Zero Escape, is a visual novel adventure video game directed by Kotaro Uchiko…
Boring Class Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 900    Accepted Submission(s): 247 Problem Description Mr. Zstu and Mr. Hdu are taking a boring class , Mr. Zstu comes up with a prob…
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…
Annoying problem Time Limit: 16000/8000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1006    Accepted Submission(s): 330 Problem Description Coco has a tree, whose nodes are conveniently labeled by 1,2,…,n, which…
In Touch Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 578    Accepted Submission(s): 160 Problem Description There are n soda living in a straight line. soda are numbered by 1,2,…,n from le…
MZL's City Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 743    Accepted Submission(s): 260 Problem Description MZL is an active girl who has her own country. Her big country has N cities numb…
Hiking Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 226    Accepted Submission(s): 126Special Judge Problem Description There are n soda conveniently labeled by 1,2,…,n. beta, their best fr…
MZL's endless loop Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1853    Accepted Submission(s): 400Special Judge Problem Description As we all kown, MZL hates the endless loop deeply, and h…
Virtual Participation Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 705    Accepted Submission(s): 202Special Judge Problem Description As we know, Rikka is poor at math. Yuta is worrying abou…
Buildings Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 185    Accepted Submission(s): 25 Problem Description Your current task is to make a ground plan for a residential building located i…