题意:就是一个打印分段收费政策,印的越多,单张价格越低,输入需要印刷的数量,求最小印刷费用一个细节就是,比当前还小的状态可能是最后几个. #include<stdio.h> #include<string.h> #include<cstdio> #include<string> #include<math.h> #include<algorithm> #include<iostream> #define LL long l…
题意:在平面上0,0点,有一个半径为R的圆形区域,并且在0,0点固定着一个半径为RM(<R)的圆形障碍物,现在圆形区域外x,y,有一个半径 为r的,并且速度为vx,vy的硬币,如果硬币碰到了障碍物,将会保持原有的速度向反射的方向继续前进,现在给出R,RM,r,x,y,vx,vy,问硬币的任意部分在圆形区域中滑行多少时间? 思路:首先把R,RM加上r,就可以把硬币看做一个点来讨论了,然后算一下射线与这两个圆交点的个数,记作C1,C2,CM1,CM2,若与两个圆的交点数都是2,答案就是dis(c1,…
题意:一个圆台,底面和顶面半径分别为R,r,然后高度为H,一共F层,每层高度一样,然后要在每层的天花板上贴方格玻璃,方格玻璃要满足以下几个条件: 方格玻璃面积不能小于S,且方格玻璃要围成一个正多边形,且正好将天花板围住(也就是说天花板的圆面是这个多边形的内接圆),并且要使得贴的玻璃数量尽量少,也就是说这个正多边形的边数要尽量少.问最后所用玻璃的总面积. 思路:先求每个圆的半径,也就是等差数列.再二分正多边行数量.二分容易出错,此题还有精度要求..... #include <iostream>…
题意:一棵有根树,每个节点都有一个value值和属性(zan或是 CANDLE).你可以通过反转一些点的属性,反转一个点时候,它的整个子树都会被反转属性.有些点反转消耗代价为X,有些为Y.你的目标的是求zan和candle差的最大值. 思路:dp[i][0]代表zan比candle多的最大值,dp[i][1]代表zan比candle少的最大值.注意每次更新当前节点的状态,如果当祖先节点加上当前节点的反转状态为偶数当然val不变,否则变.此题信息比较多,注意化繁为简.转移方程见代码 #includ…
题意:给了一个2*2的魔方..每步操作可以将任意一面翻转90度..现在问在N(<=7)步内.最多能翻出几面相同的. 直接打表模拟每种翻转情况 #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> using namespace std; ][]= { {,,,,,,,,,,,,,,,,,,,,,,,}, //ok {,,,,,,,,,,,,,,,,,,,,,,…
Alice's Print Service Time Limit: 2 Seconds      Memory Limit: 65536 KB Alice is providing print service, while the pricing doesn't seem to be reasonable, so people using her print service found some tricks to save money. For example, the price when…
题目链接 Graph Reconstruction 题意 给你无向图每个点的度数, 问是否存在唯一解, 存在输出唯一解, 多解输出两个, 无解输出IMPOSSIBLE 思路 这里用到了 Havel-Hakimi定理, 实际上就是按照度数构图的一种贪心策略. 这样能判断出来一个解或无解, 多解的情况, 只要在比较构图时最后面两个点的当前度数一样, 那么选其一都是可行的, 但是选其一的情况有保证了另外一个肯定没有连上, 所以能找到其它解. 代码 #include <bits/stdc++.h> #…
Alice's Print Service Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1855    Accepted Submission(s): 454 Problem Description Alice is providing print service, while the pricing doesn't seem to…
A - Alice's Print Service Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Submit Status Practice HDU 4791 Description Alice is providing print service, while the pricing doesn't seem to be reasonable, so people using her…
Alice's Print Service Time Limit: 2 Seconds      Memory Limit: 65536 KB Alice is providing print service, while the pricing doesn't seem to be reasonable, so people using her print service found some tricks to save money. For example, the price when…