![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
水题
文章平均质量分 63
pmt123456
这个作者很懒,什么都没留下…
展开
-
hdu 1031快排
读清题目就好做了: 1、满意度选最大的k个 2、当满意度相等时,选索引较小的那个 3、按坐标非升序排列 动态分配和静态分配用的时间一样: #include #include #include using namespace std; class node { public: double sf; int ind; public: node():sf原创 2016-10-11 08:55:21 · 464 阅读 · 0 评论 -
hdu1070
水题目,但是WA很久 不知道为什么辣么多人用double 反正我用int才过,用double一直WA #include #include #include #include using namespace std; #define eps 10e-8 const int maxn=105; const double INF=0x7fffffff; struct node {原创 2016-11-17 10:32:57 · 429 阅读 · 0 评论 -
hdu1337(模拟/完全平方数)
方法一:模拟 方法二:完全平方式的性质 分析 完全平方数的因数个数一定是奇数 对每一个门,若run down的次数是奇数,则是开着的。反之是关着的 所以本题就是找完全平方数的个数 int main() { //freopen("in.txt","r",stdin); int c,n; scanf("%d",&c); while(c--){原创 2017-02-12 14:33:41 · 339 阅读 · 0 评论 -
hdu1021(找规律,循环节)
先利用 for(int i=2;i<10;++i){ f[i]=f[i-1]+f[i-2]; if(f[i-1]==f[0]&&f[i]==f[1]) { cout<<f[i-1]<<","<<f[i]<<endl; break; } }找出循环节 #include原创 2016-09-25 23:13:40 · 439 阅读 · 0 评论 -
hdu1408(水)
题目链接: 题目分析:(D+2*D+....+i*D)=V D*(1+2+3+...+i)=V; (1+2+3+...+i)=ceil(V/D) 通过一个循环求出t #include #include int main() { //freopen("in.txt", "r", stdin);原创 2017-02-18 23:53:53 · 321 阅读 · 0 评论 -
hdu1263(结构体排序/二维map)
题目链接:水果 题目大意:给出n笔交易,交易包括水果产地,水果名字和价格,要求按如下格式输出 产地 |----水果名称1(收益) |----水果名称2(收益) 按字母序排列 题目分析: 做法1:结构体排序 用place和name存储当前的产地和名字, 向后比较,每比较到不同的产地就输出上一个的place和和name 如果比较到相同的产地但名字不同,就输出上一个的名字原创 2017-01-06 09:01:09 · 680 阅读 · 0 评论 -
hdu1201(水)
题目链接:18岁生日 给出出生日期,问到18岁生日有多少天 如图,我们要求的实际是黑线的区域,但为了简化计算我实际是按红线区域求得 因此在端点出也要判断闰年的情况 如果出生当年是闰年,且在2月之前出生,我们就经过了一个闰年,但在计算时没有加进去,因此要加上一天 同理在18岁生日当年也要判断 #include using namespace std; #include原创 2016-12-09 18:47:14 · 677 阅读 · 0 评论 -
hdu1194(水)
题目链接Beat the Spread! 给定两个分数a,b的和与差的绝对值(a,b∈N),如果能求出a,b就直接输出,否则输出impossible 注意int型计算(a+b)/2和(a-b)/2自动取整 因此要判断a,b是否同是奇数或者同是偶数,否则我们也是计算不出来的 #include #include using namespace std; int main原创 2016-12-09 17:11:58 · 453 阅读 · 0 评论 -
hdu1084
题目链接What Is Your Grade? 解5道题得100分 解4道题,如果你在解四道题的人当中排在前面的一半得95分,否则90分 以此类推 模拟,注意只有一个人解4,3...道题的情况 #include #include #include using namespace std; const int maxn=105; struct node {原创 2016-12-05 18:19:21 · 484 阅读 · 0 评论 -
hdu1071定积分
抛物线标准公式带入P1可求得a 直线 点斜式 两者相减求定积分 #include #include using namespace std; double a,b,c,k,d; double fun(double x) { return a*x*x*x/3-(2*a*b+k)*x*x/2+(a*b*b+c-d)*x; } int main() { //freopen原创 2016-11-18 09:46:02 · 1318 阅读 · 0 评论