自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

梦幻的蔷薇色

迁移至新博客:hiyongheng.cn-------我也向往蔷薇色的生活啊,可我是灰色的。

  • 博客(24)
  • 资源 (8)
  • 收藏
  • 关注

原创 codeforces 820B Mister B and Angle in Polygon

同弧所对的圆周角相等,我做的时候没想到,连圆周角的概念都有点模糊了 固定一个点,枚举另外两个点,tle。笨到家了#include <bits/stdc++.h>using namespace std;typedef long long ll;const int MAXN = 1e5+10;ll n;double a;double anglesum;double angle,outsi

2017-06-28 22:04:06 507

原创 codeforces 820A Mister B and Book Reading

虽说水题一道,但是刚做的时候竟然忘了”else v0 = v1”,我去,wa了几发#include <iostream>using namespace std;int main(){ long long c,v0,v1,a,l; cin >> c >> v0 >> v1 >> a >> l; long long page = v0; long long res =

2017-06-28 21:33:16 310

原创 codeforces 817D Imbalanced Array(单调栈)

碰到这题不会做,看题解说是单调栈,就去学了学单调栈,回头再做这题。结果在处理边界的时候犯了个很sx的错误,竟然还想了好几天才发现错误 思路: 设la[i]为从num[i]向左数第一个比num[i]小的数字的下标,ra[i]为从num[i]向右数第一个比num[i]小的数字的下标,则区间(la[i],ra[i])中的最小值就是num[i],(i-la[i])*(ra[i]-i)就是这段区间包含

2017-06-21 14:39:46 412

原创 codeforces 817C Really Big Numbers

第一眼感觉是dp,但是不知道该怎么写。看cf题解是二分,就按照题解写了,不过还是要看看dp解法。#include <bits/stdc++.h>using namespace std;typedef long long ll;ll n,s;bool check(ll num){ ll sum = 0; ll temp = num; while(temp) {

2017-06-21 14:18:53 343

原创 51nod 1001 数组中和等于K的数对(二分)

A数组排序,设b=K-A[i],然后在A里面二分查找b#include <cstdio>#include <cstring>#include <algorithm>using namespace std;const int MAXN = 5e4+10;int num[MAXN];bool mark[MAXN];//查找过的数字标记为trueint k,n;bool bs(int numb

2017-06-19 18:33:39 261

原创 51nod 1272 最大距离(贪心)

没想到。。。。 参考:http://blog.csdn.net/qq_21057881/article/details/52739386#include <iostream>#include <algorithm>using namespace std;const int MAXN = 5e4+10;int num[MAXN];int index[MAXN];int main(){

2017-06-19 18:15:44 280

原创 51nod 1102 面积最大的矩形(单调栈)

以i所指的矩形高度作为要组成的矩形的高度,分别向左右扩展。用单调栈维护一个left数组和一个right数组,记录向左右能扩展到的边界,然后扫一遍出结果。#include <iostream>#include <stack>#include <algorithm>using namespace std;const int MAXN = 5e4+10;long long num[MAXN];i

2017-06-18 16:28:20 333

原创 51nod 1279 扔盘子(单调栈)

开始是直接从井口往里扔,复杂度是O(n^2),超时。。然后呢,你会发现,如果井上边的宽度小,下边的宽度大,那么下边宽度多大都是没用的,所以就让他等于上边宽度就好了。然后处理后这个井的宽度从上到下就是一个非递增的了,然后从下向上匹配,O(n)。。。。还可以用单调栈预处理#include <cstdio>#include <cstring>const int MAXN = 50050;int n,

2017-06-18 12:13:06 389

原创 Educational Codeforces Round 23 B - Makes And The Product

简单排列组合,又来水了俩水题。。。#include <iostream>#include <map>#include <algorithm>using namespace std;typedef long long ll;map<ll,ll> table;ll n,num;ll C(ll n, ll m){ ll res = 1; for(ll i = 1; i <= m

2017-06-16 16:28:02 299

原创 Educational Codeforces Round 23 A - Treasure Hunt

#include <bits/stdc++.h>using namespace std;int main(){ int x1,y1,x2,y2,x,y; cin >> x1 >> y1 >> x2 >> y2; cin >> x >> y; int derx,dery; int flag1 = -1,flag2 = -1; derx = abs(x

2017-06-16 16:25:32 316

原创 组合数计算,防止溢出

#include <iostream>using namespace std;typedef long long ll;ll C(ll n, ll m){ ll res = 1; for(ll i = 1; i <= m; ++i) res = res*(n-m+i)/i; return res;}int main(){ cout << C

2017-06-16 13:40:06 453

原创 51nod 1161 Partial Sums

相关讨论里的没看懂,扯到矩阵就不会了,补线代。。。 参考:http://blog.csdn.net/qingshui23/article/details/52180926 http://blog.csdn.net/yitiaodacaidog/article/details/38071257 看着博客里的规律,自己画画,就出来规律了。可是真不知道怎么去找这规律。。。还要补数学。。 这个题还有

2017-06-13 19:45:36 384

原创 线性求逆元

#include <iostream>using namespace std;const int N = 10000005;const int mod = 1e9+7;int inv[N];void init(){ inv[1] = 1; for(int i=2; i<N; i++) { if(i >= mod) break; inv[

2017-06-12 19:35:34 260

原创 线性筛法求素数

#include <iostream>#include <cstring>using namespace std;const int MAXN = 1e6+10;int prime[MAXN];int numPrime;int isPrime[MAXN];void getPrime(){ numPrime = 0; memset(isPrime,0,sizeof(isPr

2017-06-12 17:39:10 250

原创 矩阵快速幂(斐波那契数列)

#include <iostream>#include <vector>using namespace std;typedef long long ll;typedef vector<ll> vec;typedef vector<vec> mat;const ll mod = 1e9+9;mat mul(mat& A, mat &B){ mat C(A.size(),vec(B[

2017-06-12 17:06:39 268

原创 51nod 1459 迷宫游戏

#include <cstdio>#include <cstring>#include <set>#include <algorithm>using namespace std;const int INF = 0x3f3f3f3f;const int MAXN = 510;int G[MAXN][MAXN];int Score[MAXN];int Dist[MAXN];bool V

2017-06-08 20:09:34 243

原创 codeforces 814C An impassioned circulation of affection

每次做cf基本就前两个,第三个就死掉了。。 这个题呢,看到题还是有有点想法的。先想dp。。做不出来。后来想到尺取法。。结果错了。。。还是去看了题解。。以后还是先写c题。。。 参考:http://blog.csdn.net/qq_33183401/article/details/72906503 尺取法还是很好想的#include <cstdio>#include <cstring>#def

2017-06-08 18:34:28 338

原创 codeforces 813C. The Tag Game

思路:计算出所有点到1号点的最短距离,到x号点的最短距离,然后找到一些这样的点,这个点到x点的距离小于到1号点的距离,然后选出这些点中距离1号点最远的点就是结果。#include <cstdio>#include <cstring>#include <vector>#include <queue>using std::priority_queue;using std::vector;c

2017-06-06 18:15:48 368

原创 51nod 1253 Kundu and Tree

容斥原理+并查集。。第一次见这样的题,涨姿势了,不看题解想不出。 看了题解后才发现很简单。 题解: http://blog.csdn.net/crybymyself/article/details/68062911 http://www.cnblogs.com/Stomach-ache/p/3931848.html一个讲的细,用dfs求的连通分量。 一个讲的粗略,用的并查集。。 思路:首

2017-06-05 22:20:17 317

原创 Codeforces Round #417 (Div. 2) C. Sagheer and Nubian Market

看了别人的题解,看懂题目了,说是二分,然后就二分做,结果就是超时了。我枚举了k,对每个k,二分求的花费 看了看cf题解,说是二分k,然后又二分,边界问题处理了好久。。平时二分做的少,碰到二分的时候,处理边界就是个大问题了。。要练练二分了。。#include <iostream>#include <algorithm>using namespace std;typedef long long

2017-06-03 17:52:53 261

原创 Codeforces Round #417 (Div. 2) B. Sagheer, the Hausmeister

水题,注意细节。 第三题没看懂题目。明天再看看#include <cstdio>#include <cstring>#include <algorithm>using namespace std;char G[20][110];int n,m;int dp[20][2];void createLR(int &l, int &r, int row){ int i; for

2017-06-02 01:27:03 364

原创 Codeforces Round #417 (Div. 2) A. Sagheer and Crossroads

水题,注意细节。#include <iostream>#include <algorithm>using namespace std;int light[4][4];int main(){ for(int i = 0; i < 4; ++i) { for(int j = 0; j < 4; ++j) cin >> light[i][j];

2017-06-02 01:18:10 283

原创 51nod 1806 wangyurzee的树(purfer,容斥原理)

又涨知识了,purfer序列计算生成树个数,purfer序列讲解:http://www.cnblogs.com/zhj5chengfeng/archive/2013/08/23/3278557.html 前几天看这个题,以为一定要满足m个限制条件,就直接套公式算起来了,错了。看题解,说是容斥原理,感觉很懵逼,满足m个条件直接算就行了,怎么容斥?今天再看才想起来,是满足1个,2个,3个…….m个条件

2017-06-01 19:55:18 409

原创 51nod 1274 最长递增路径(dp)

第一次做图上的dp,猛一看还真有点懵,不过看看讨论,看看别人的代码,也就想通了。 参考:http://blog.csdn.net/f_zyj/article/details/70238725#include <iostream>#include <algorithm>using namespace std;struct Edge{ int s,e,w;};const int MA

2017-06-01 16:08:40 311

循环小数-康明昌

讲解循环小数的数学规律

2017-08-22

循环小数性质及证明

循环小数的性质及证明

2017-07-27

Java语言程序设计第八版补充材料

Java语言程序设计第八版补充材料

2017-07-18

Qt5实现拼图+自动寻路

Qt5实现的拼图,添加了一个自动寻路的功能

2017-03-31

根据哈夫曼编码写的数据压缩解压软件(java实现)

根绝哈夫曼编码写的数据压缩解压软件

2016-11-28

QStackedLayout实现多界面切换

用QStackedLayout实现多界面切换

2016-11-12

简单架设“FTP” 工具

简简单单架设属于自己的FTP空间,绿色无毒,占空间小,使用简单方便

2011-08-13

空空如也

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

TA关注的人

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