自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Yishui_lovely

败犬~~

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

原创 Poj 3264 Balanced Lineup ( 线段树

Balanced LineupDescriptionFor the daily milking, Farmer John’s N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of

2017-07-31 20:32:29 283

原创 浅谈容斥原理鸽巢原理(抽屉原理

容斥原理算法简述在集合S中至少具有,,…中的一个元素的个数是:主要运用场合与思路:简单的讲:容斥原理的最重要的应用就是去重。如果完成一件事情有n类方式,…,每一类进行方式有中方法(1 <= i <=n),但是这些方法在合并时存在重叠现象,这时可以选择尝试容斥原理。在比赛中单独使用容斥原理的情况并不多见,常见的问题有错排问题等。模板可以用二进制的思想来枚举所有可能的情况,若某位上置1则表示要选取该元素

2017-07-31 02:45:32 2199

原创 浅谈欧拉定理

欧拉定理若n,a为正整数,且n,a互质,(a,n) = 1,则a^φ(n) ≡ 1 (mod n) 特别的φ(1)=1欧拉函数性质(1) p^k型欧拉函数:若N是质数p(即N=p), φ(n)= φ(p)=p-p^(k-1)=p-1。若N是质数p的k次幂(即N=p^k),φ(n)=p^k-p^(k-1)=(p-1)p^(k-1)。(2)mn型欧拉函数设n为正整数,以φ(n)表示不超过n且与n

2017-07-30 21:49:42 1568

原创 浅谈扩展欧几里得

扩展欧几里得算法求的是方程 的解原理: 设 a>b,当b==0时,,此时x=1,y=0,否则设 由于,所以进一步得到 所以得到 代码实现void extend(LL a, LL b, LL, &x, LL &y ){ if(b == 0) { x = 1; y = 0; return ; } extend(b

2017-07-30 20:52:17 312

原创 BZoj 1083: [SCOI2005]繁忙的都市( 最小生成树

1083: [SCOI2005]繁忙的都市Description 城市C是一个非常繁忙的大都市,城市中的道路十分的拥挤,于是市长决定对其中的道路进行改造。城市C的道 路是这样分布的:城市中有n个交叉路口,有些交叉路口之间有道路相连,两个交叉路口之间最多有一条道路相连 接。这些道路是双向的,且把所有的交叉路口直接或间接的连接起来了。每条道路都有一个分值,分值越小表示这 个道路越繁忙,越需要进行改

2017-07-28 21:24:26 309

原创 Codeforces #390 (Div. 2) B. Ilya and tic-tac-toe game ( DFS

B. Ilya and tic-tac-toe gameDescriptionIlya is an experienced player in tic-tac-toe on the 4 × 4 field. He always starts and plays with Xs. He played a lot of games today with his friend Arseny. The fr

2017-07-28 21:22:06 324

原创 HPUoj 1084: 矩形嵌套问题( DAG/LIS

1084: 矩形嵌套问题Description有n个矩形,每个矩形可以用两个整数a,b描述,表示它的长和宽。矩形X(a,b)可以嵌套在矩形Y(c,d)中当且仅当aInput每组测试数据的第一行是一个正整数n,表示该组测试数据中含有矩形的个数(n<=1000)随后的n行,每行有两个数a,b(0Output每组测试数据都输出一个数,表示最多符合条件的矩形数目,每组输出占一行Sample Input10

2017-07-28 11:37:11 386

原创 17多校contest two 1011Regular polygon ( 计算几何

Regular polygonDescriptionOn a two-dimensional plane, give you n integer points. Your task is to figure out how many different regular polygon these points can make.InputThe input file consists of seve

2017-07-28 09:28:01 308

原创 Codeforces #245 (Div. 2)C. Xor-tree(DFS&&贪心

C. Xor-treeDescriptionahub is very proud of his recent discovery, propagating trees. Right now, he invented a new tree, called xor-tree. After this new revolutionary discovery, he invented a game for k

2017-07-27 08:47:26 630

原创 Codeforces #245 (Div. 2) D.Working out (dp

Working out DescriptionSummer is coming! It’s time for Iahub and Iahubina to work out, as they both want to look hot at the beach. The gym where they go is a matrix a with n lines and m columns. Let nu

2017-07-27 08:36:23 268

原创 17多校contest 1 - 1011 KazaQ's Socks (规律

KazaQ’s SocksDescriptionKazaQ wears socks everyday.At the beginning, he has n pairs of socks numbered from 1 to n in his closets. Every morning, he puts on a pair of socks which has the smallest number

2017-07-25 23:00:41 360

原创 Poj 1985 Cow Marathon ( 树的直径

Cow MarathonDescriptionAfter hearing about the epidemic of obesity in the USA, Farmer John wants his cows to get more exercise, so he has committed to create a bovine marathon for his cows to run. The

2017-07-24 00:38:43 597

原创 Poj1383 - Labyrinth (搜索

DescriptionThe northern part of the Pyramid contains a very large and complicated labyrinth. The labyrinth is divided into square blocks, each of them either filled by rock, or free. There is also a li

2017-07-24 00:28:20 328

原创 Codeforces Round #14 (Div. 2) D. Two Paths ( 树的直径

Two Paths DescriptionAs you know, Bob’s brother lives in Flatland. In Flatland there are n cities, connected by n - 1 two-way roads. The cities are numbered from 1 to n. You can get from one city to an

2017-07-23 23:59:27 274

原创 HDUoj 5723 Abandoned country(最小生成树+dfs

Abandoned countryDescriptionAn abandoned country has n(n≤100000) villages which are numbered from 1 to n. Since abandoned for a long time, the roads need to be re-built. There are m(m≤1000000) roads to

2017-07-23 23:58:57 257

原创 邻接表的vector表示方法

无向无权图#include <bits/stdc++.h>using namespace std;vector<int> v[N];const int N = 1e5;int main(){ int n, m; cin>>n>>m; int s, t; for(int i = 0;i < m; i++) { cin>>s>>t;

2017-07-23 19:05:48 679

原创 HPU16级暑期集训练习(一)

一堆水题也不会写 中间写的想吐mmp 好菜啊A 题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=1994题解对着上面的公式抄下就好 太长才开始懒得看AC代码#include <bits/stdc++.h>using namespace std;#define LL long long#define lson l , m , rt << 1#defi

2017-07-22 14:01:09 481 2

原创 Codeforces Round 22 C. The Tag Game ( 搜索

C. The Tag GameDescriptionAlice got tired of playing the tag game by the usual rules so she offered Bob a little modification to it. Now the game should be played on an undirected rooted tree of n vert

2017-07-21 23:55:47 381

原创 在ACM竞赛中string的几个基本操作

在ACM竞赛中string的几个基本操作赋值直接来就行:  string ss;  ss="aaa";  或者  string sa,sb;  cin>>sa;  sb=sa;添加在末尾加字符或字符串直接用加号:  string ss;  ss+='a';  ss+="aaa";  在中间插入一个字符用ss.insert()函数:  ss.insert(ss.begin()+1,'a');//在ss

2017-07-18 21:58:40 875

原创 Codeforces Round #423 (Div. 2) A&&B&& C

A. Restaurant TablesDescriptionIn a small restaurant there are a tables for one person and b tables for two persons.It it known that n groups of people come today, each consisting of one or two people.

2017-07-18 21:47:11 480

原创 输入挂与手动加栈

参考bloghttp://www.cnblogs.com/xiaohongmao/archive/2012/05/29/2523760.html G++防止TLE利用输入挂加速整数inline bool scan_d(int &num) { char in;bool IsN=false; in=getchar(); if(in==EOF) ret

2017-07-18 17:08:54 257

原创 Codeforces Round #201 (Div. 2) C. Alice and Bob ( 数学

C. Alice and BobDescriptionIt is so boring in the summer holiday, isn’t it? So Alice and Bob have invented a new game to play. The rules are as follows. First, they get a set of n distinct integers. An

2017-07-18 11:26:03 323

空空如也

空空如也

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

TA关注的人

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