题目链接:5288-5299 HDU5288 题解原文链接:我是链接…
---------- HDU 5288 OO’s Sequence 题意 给定一个数列(长度<$10^5$),求有多少区间[l,r],且区间内有多少数,满足区间内其它数不是他的约数. 数的范围$[1,10000]$.结果对$10^9+7$取模. Solution 首先可以预处理每个数的约数有哪些.对每个数存下它的位置有哪些. 然后可以枚举每一个位置,利用二分找到左边第一个是它约数的数,和右边第一个是他约数的数. 假设向左有L个数,向右有R个数.那么ans应该加上(L*R). 时间复杂度$O(n*…
A - Acperience HDU - 5734 题意: 给你一个加权向量,需要我们找到一个二进制向量和一个比例因子α,使得|W-αB|的平方最小,而B的取值为+1,-1,我们首先可以想到α为输入数据的平均值,考虑到是平方和,然后化简表达式,可以得到一个化简的式子,用n通分,可以做到没有除法,然后分子分母化简到互质. #define _CRT_SECURE_NO_WARNINGS #include<cstdio> #include<cstring> #include<iom…
我只能说: A Boring Question 下面公式重复了一行 \[ \sum\_{0\leq k\_{1},k\_{2},\cdots k\_{m}\leq n}\prod\_{1\leq j< m}\binom{k\_{j+1}}{k\_{j}} \\\ =\sum\_{0\leq k\_{1}\leq k\_{2}\leq\cdots \leq k\_{m}\leq n}\prod\_{1\leq j< m}\binom{k\_{j+1}}{k\_{j}} \\\ =\sum\_{k…
solved 7/11 2016 Multi-University Training Contest 10 题解链接 分类讨论 1001 Median(BH) 题意: 有长度为n排好序的序列,给两段子序列[l1,r1],[l2,r2]构成新的序列,问中间的数字. 思路: 根据不同情况分类讨论即可.时间复杂度O(1). 代码: #include <bits/stdc++.h> const int N = 1e5 + 5; int a[N]; int n, m; int l1, r1, l2, r…
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…
2015 UESTC Winter Training #8 The 2011 Rocky Mountain Regional Contest Regionals 2011 >> North America - Rocky Mountain 开始时貌似是UVAlive挂了,无论交什么都WA,后来转战HDU 这次水题比较多,其中B题据说有更加高级的方法. G题WA了两发,才发现竟然没有输出Case!!! 未完成:D F H I J A - Iterated Difference 水题,模拟迭代即可…
2015 UESTC Winter Training #7 2010-2011 Petrozavodsk Winter Training Camp, Saratov State U Contest 据说这套题写出3题就是金牌水平了... Problem D. Group Stage 足球比赛,现在有n(2<= n <=100)支球队.要从中选拔m(1<= m <=n-1)支球队,每支球队互相比赛一场,即比赛n*(n-1)/2场,胜者得3分,平局各得1分.最后从大到小列出排名,如果有…
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…
官方解题报告:http://bestcoder.hdu.edu.cn/blog/2015-multi-university-training-contest-6-solutions-by-zju/ 表示很难看....orz 1003题      链接:http://acm.hdu.edu.cn/showproblem.php?pid=5355 Cake Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K…
Hiking Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 97    Accepted Submission(s): 56 Special Judge Problem Description There are n soda conveniently labeled by 1,2,-,n. beta, their best fr…
OO's Sequence                                                          Time Limit: 4000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)                                                                                             T…
Tricks Device Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 389    Accepted Submission(s): 100 Problem Description Innocent Wu follows Dumb Zhang into a ancient tomb. Innocent Wu's at the ent…
CRB and Tree                                                             Time Limit: 8000/4000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)                                                                                            To…
I Wanna Become A 24-Point Master Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 60    Accepted Submission(s): 16 Special Judge Problem Description Recently Rikka falls in love with an old but…
CRB and Apple Time Limit: 12000/6000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 421    Accepted Submission(s): 131 Problem Description In Codeland there are many apple trees.One day CRB and his girlfriend decide…
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…
Just A String Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 643    Accepted Submission(s): 182 Problem Descriptionsoda has a random string of length n which is generated by the following alg…
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…
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…
Danganronpa Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 318    Accepted Submission(s): 176 Problem Description 给你n个A串,m个B串,对每个A串,询问,这些B串们在该A串中一共出现过多少次 Input 样例个数 n m 接下来n个A串 接下来m个B串 Output…
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…
Segment Game Time Limit: 3000/1500 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 446    Accepted Submission(s): 95 Problem Description Lillian is a clever girl so that she has lots of fans and often receives gifts…
Mahjong tree Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 388    Accepted Submission(s): 125 Problem Description Little sun is an artist. Today he is playing mahjong alone. He suddenly feels…