![](https://img-blog.csdnimg.cn/20201014180756930.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
STL
deepquiet
这个作者很懒,什么都没留下…
展开
-
Calculator Conundrum
题意: 给出位数和一个数,求出在位数内的数的次方的最大值 思路: 循环控制条件是得到的数已经得到过,即处理数出现循环,则无须再处理了,所以用到了set,用来判断处理数是否出现过 那截取位数用到了sstream s > ans, 将字符串转为数字 代码: #include #include #include using namespace std; int k, n; int next(原创 2016-02-05 15:08:28 · 323 阅读 · 0 评论 -
Colored Cubes
题意: 给出n个带颜色的正方体,求改变最少面的颜色使得所有正方体一样 思路: 以第一个正方体最为基准,通过所有旋转,求出最多重叠面的值#include #include #include #include #include #include using namespace std; map color; int cube[5][6], now[5][6]; int cnt[25]; int原创 2016-02-05 11:30:19 · 286 阅读 · 0 评论 -
Meteor
题意: 给出流星的初始位置和速度,求某个时刻框内流星的数目最多 思路: 求出流星在框内出现的时间段,然后对各时间段扫描,遇到左端点就累加,遇到右端点表示流星出框,集合交集最多的地方就是所求 ps:过了很就以后补的博客,可能有错 代码: #include #include #include using namespace std; int w, h, n; struct star {原创 2016-02-05 15:32:02 · 245 阅读 · 0 评论 -
Network
题意: n台机器连成一个树状网络,其中叶节点是客户端,其他结点是服务器。目前有一台服务器正在提供VOD服务,虽然视频本身质量不错,但对于那些离它很远的客户端来说,网络延迟却难以忍受。你的任务是在一些其他服务器上也安装同样的服务,使得每台客户端到最近服务器的距离不超过一个给定的整数k。为了节约成本,安装服务的服务器台数应尽量少。 思路: 第一次遍历这个树,将距离VOD超过k的叶结点存入变长数组原创 2016-02-04 23:51:03 · 357 阅读 · 0 评论 -
Compound Words
题意: 给出几个串,输出能有里面的串组成的串 思路: 将每个串存在集合里面,然后将每个串截成不同形式,在集合里寻找是否有这个串 代码: #include #include #include #include #include using namespace std; int main() { string s; set res; while(cin>>s) { res.inse原创 2016-03-09 22:03:49 · 569 阅读 · 0 评论 -
Balancing the Scale
the main algorithm: use a array to save the number of the combination(use the way of combination as flag) and multiply the i ans 1 code: #include #include #include #include #include using namespace原创 2016-03-12 19:48:34 · 356 阅读 · 0 评论 -
uva141
题意: 两个人下棋,如果出现重复的棋局则这个人则输,重复包括旋转之后的情况,如果超过2*n次还没分出胜负则平局 思路: 先讲用到set的方法,这里把二维数组封装在结构体里面,此时set必须得手写 这里着重提一下重载出现的错误 bool operator for(int i=1; i for(int j=1; j if(a.arr[i][j] } return原创 2016-05-18 15:33:58 · 400 阅读 · 0 评论