自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(22)
  • 收藏
  • 关注

原创 Maximum Product UVA - 11059(水题)

闲得无聊刷到水题,但还是错了0.0 第一点注意的每个输出后面都有空行 第二点要用long long 第三点mx初值为0#include <bits/stdc++.h>#define ll long long#define pb push_back#define inf 0x3f3f3f3f#define rep(i,a,b) for(int i=a;i<b;...

2018-02-13 23:33:37 142

原创 Division UVA - 725(暴力)

题目链接 直接枚举第一个数字,然后如果可以整除n的话除以n得到第二个数字判断第二个数字是否满足条件,我感觉我的代码好长长长。。。#include <bits/stdc++.h>#define ll long long#define pb push_back#define inf 0x3f3f3f3f#define rep(i,a,b) for(int i=a;i<b...

2018-02-11 23:21:26 259

原创 Paintball UVA - 11853(模拟,贪心)

链接 一个模拟题,我们要从与上边界相切的圆开始考虑,然后考虑与这种圆相切的圆,如果这种圆和左边界有交点,就比较之后修改入点,和右边界有交点,就比较之后修改出点,因为他们上面都是出不去的#include <bits/stdc++.h>#define ll long long#define pb push_back#define inf 0x3f3f3f3f#define r...

2018-02-10 20:04:43 159

原创 System Dependencies UVA - 506(细节题)

细节题,有一点需要注意,就是vector中的erase和remove配合使用才能删除元素,详见STL中erase和remove的使用#include <bits/stdc++.h>#define ll long long#define pb push_back#define inf 0x3f3f3f3f#define rep(i,a,b) for(int i=a;i<...

2018-02-09 11:49:19 195

转载 STL Vector remove()和erase()的使用

STL中remove()只是将待删除元素之后的元素移动到vector的前端,而不是删除。若要真正移除,需要搭配使用erase()。 例子如下: [cpp] view plain copy#include <iostream> #include <vector> #include <algorithm> #include <functio...

2018-02-09 11:45:18 5497

原创 UVa1599 Ideal Path(双向bfs+队列判重)

紫书上的一道例题,题目链接做两次bfs,第一次记录可达n的点到n的距离,到点1为止 第二次 要在距离满足上一个点-1的基础上找边的最小值,这道题并不需要找到一条路径,只需要输出边的值即可,所以即便有多条边,也直接记录最小值就好了。 需要注意的一点,为了避免超时,需要加一个优化,用v数组来记录点是否被加入到队列中,即队列去重#include <bits/stdc++.h>#...

2018-02-09 02:04:41 266

原创 Codeforces Round #461 (Div. 2) D. Robot Vacuum Cleaner(贪心)

D. Robot Vacuum Cleaner time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outputPushok the dog has been chasing Imp for a few hours alread...

2018-02-08 14:04:47 161

原创 Codeforces Round #461 (Div. 2) C. Cave Painting(暴力)

C. Cave Painting time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outputImp is watching a documentary about cave painting.Some numbers,...

2018-02-08 13:49:07 221

原创 Codeforces Round #461 (Div. 2) A. Cloning Toys(水题)

A. Cloning Toys time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outputImp likes his plush toy a lot.Recently, he found a machine that ...

2018-02-08 13:12:12 486

原创 UVA - 1572 Self-Assembly (状态化简,找环)

把标号看成点,正方形看成边,如果一个点和另一个正方形的一个点有链接的话,那么可以看成这个点和另一个正方形的剩下三个点之间有有向边,所以我们可以把所有点编号,建图,然后找有没有环就好了。 不过还是有很多小技巧的,比如建边时,一个点的编号异或1的编号可以与这个正方形其他点建边#include #define ll long long#define pb push_back#define

2018-02-06 11:14:58 233

原创 Undraw the Trees UVA 10562(递归写树)

这道题不难,直接做就好了,但是对边界的要求还是比较严格的,需要处理的细节比较多#include #define ll long long#define pb push_back#define inf 0x3f3f3f3f#define rep(i,a,b) for(int i=a;i#define rep1(i,a,b) for(int i=a;i>=b;i--)#define

2018-02-05 16:24:01 236

原创 Codeforces Round #458 D. Bash and a Tough Math Puzzle(线段树)

D. Bash and a Tough Math Puzzle time limit per test 2.5 seconds memory limit per test 256 megabytes input standard input output standard outputBash likes playing with arrays. He has an array

2018-02-05 11:19:56 266

原创 Codeforces Round #458 (Div. 1 + Div. 2)C. Travelling Salesman and Special Numbers

C. Travelling Salesman and Special Numbers time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outputThe Travelling Salesman spends a lot of

2018-02-05 09:37:29 326

原创 Codeforces 920F - SUM and REPLACE(线段树)

题意:给你n个数,进行m次操作,分别是将区间[l,r]内的所有数替换成自己的因子数 和 对区间[l,r]进行求和。题解: 调试了一下午,原来是运算符号优先级的问题。或运算符和+不要一起用 解析:线段树问题,但是直接做的话会超时,所以要加一个优化,可以发现2的因子个数还是2,1的因子个数还是1,所以如果某个数被更新成1或者2之后就不需要再进行更新了。 这里给张线段树的图 代码:#

2018-02-04 15:45:28 576

原创 Codeforces Round #419 (Div. 2) B. Karen and Coffee

B. Karen and Coffee time limit per test 2.5 seconds memory limit per test 512 megabytes input standard input output standard outputTo stay woke and attentive during classes, Karen needs some

2018-02-04 13:18:01 107

原创 Educational Codeforces Round 37 E. Connected Components?(bfs)

E. Connected Components? time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard outputYou are given an undirected graph consisting of n vertic

2018-02-03 23:31:51 208

原创 codeforces 508E Arthur and Brackets (栈)

Arthur and Brackets time limit per test 2 seconds memory limit per test 128 megabytes input standard input output standard outputNotice that the memory limit is non-standard.Recently Arthu

2018-02-02 16:03:41 227

原创 CodeForce 439C Devu and Partitioning of the Array

Devu and Partitioning of the Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outputDevu being a small kid, likes to play a lot, bu

2018-02-02 11:57:45 225

原创 Codeforces 526C - Om Nom and Candies(贪心)

C. Om Nom and Candies time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outputA sweet little monster Om Nom loves candies very much. One d

2018-02-01 20:54:57 303

原创 Codeforces Round #322 (Div. 2)C. Developing Skills

C. Developing Skills time limit per test 1 second memory limit per test 256 megabytes input standard input output standard outputPetya loves computer games. Finally a game that he’s been waitin

2018-02-01 18:12:07 132

原创 Codeforces Round #460 (Div. 2) D. Substring(拓扑排序)

D. Substring time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard outputYou are given a graph with n nodes and m directed edges. One lowerca

2018-02-01 17:04:49 286

原创 Codeforces Round #460 (Div. 2) C. Seat Arrangements(特殊化数据)

题目链接刚开始没有想到k==1,的情况,这种情况下会搜到重复的点,所以k==1时要特殊处理,锁题被hack之后就gg#include #define ll long long#define pb push_back#define inf 0x3f3f3f3f#define rep(i,a,b) for(int i=a;i#define rep1(i,a,b) for(int i=

2018-02-01 11:26:43 190

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除