Building Shops Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 0    Accepted Submission(s): 0 Problem Description HDU’s n classrooms are on a line ,which can be considered as a number line. Ea…
Building Shops Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Total Submission(s): 701 Accepted Submission(s): 265 Problem Description HDU’s n classrooms are on a line ,which can be considered as a number line. Eac…
Deleting Edges Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 567    Accepted Submission(s): 210 Problem Description Little Q is crazy about graph theory, and now he creates a game about grap…
Happy Necklace Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1146    Accepted Submission(s): 491 Problem Description Little Q wants to buy a necklace for his girlfriend. Necklaces are single…
Graph Theory Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1796    Accepted Submission(s): 750 Problem Description Little Q loves playing with different kinds of graphs very much. One day he…
这是CCPC女生专场的一道dp题.大佬们都说它简单,我并没有感到它有多简单. 先说一下题意:在一条直线上,有n个教室,现在我要在这些教室里从左到右地建设一些作为糖果屋,每个教室都有自己的坐标xi 和建造糖果屋的费用ci , 如果在这里建造一个糖果屋,那么花费ci ,如果不建造糖果屋,则花费是当前教室的坐标与左边最靠近当前教室的糖果屋坐标之差,问最小花费. 一看这是个求最优解的问题,应该明白这是个dp问题,现在来考虑该问题状态的定义: 当我建设到第i个教室的时候,我有两种选择,建糖果屋或者不建糖果…
C HDU - 6025 [题意]:去除数列中的一个数字,使去除后的数列中所有数字的gcd尽可能大. [分析]: 数组prefixgcd[],对于prefixgcd[i]=g,g为a[0]-a[i]的GCD,称为前缀GCD. 数组suffixgcd[],对于suffixgcd[i]=g,g为a[i]-a[n-1]的GCD,称为后缀GCD. 有了这两个GCD值的数组,那么去掉a[i]的GCD为gcd(prefixgcd[i - 1], suffixgcd[i + 1]),从中找出最大值即可. [代…
B HDU - 6024 [题意]:n个教室,选一些教室建造糖果商店. 每个教室,有一个坐标xi和在这个教室建造糖果商店的花费ci. 对于每一个教室,如果这个教室建造糖果商店,花费就是ci,否则就是与坐标在自己前面的建造糖果商店的距离, 求最小花费. [分析]: 题解1.首先最左面的楼是必须要建商店的.考虑dp,dp[i][j]表示在第i栋楼是否建商店的最小花费(0不建,1建). j==1:则dp[i][1]=min(dp[i-1][1],dp[i-1][0]) + 建商店花费; j==0:则我…
A HDU - 6023 [题意]:求AC题数和总时长. [分析]:模拟.设置标记数组记录AC与否,再设置错题数组记录错的次数.罚时罚在该题上,该题没AC则不计入总时间,AC则计入.已经AC的题不用再管,因为不会再罚时. [代码]: #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #include<string> #include<vecto…
Combine String #include<cstdio> #include<cstring> #include<iostream> #include<algorithm> #include<cmath> #include<queue> #include<vector> #include<map> using namespace std; typedef unsigned long long LL; #de…