自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

转载 3D Convex Hull (三维凸包模板)

转载自:http://blog.csdn.net/ms961516792/article/details/48227385题意:给出一些三维的点,求出一个凸包,输出凸包有多少个表面。思路:模板。。。队友找了一个巨全面的模板,贴过来。#include<stdio.h> #include<algorithm> #include<string.h> #include<math.h> #in

2017-03-31 00:31:20 2597

转载 uvalive 4998 Simple Encryption --DFS

题意: 给出K1,求一个12位数(不含前导0)K2,使得K1^K2 mod (10^12) = K2.解法: 求不动点问题。有一个性质: 如果12位数K2满足如上式子的话,那么K2%1,K2%10,K2%100,…,K2%10^12都会满足如上式子。那么我们可以dfs从后往前一个一个找出这个数的每一位。转载至:http://www.bubuko.com/infodetail-587732.html这

2017-03-30 23:24:02 391

转载 The queue uvalive 5002 light 1382 uva 12257 (dfs加组合数学)

题目大概是说给一棵树的n个结点从1到n编号,要求每个结点的编号大于其父结点,问有多少种编号方式。想了挺久的,感觉有点眉目,最后画了下样例YY出解法:首先求出以每个结点为根的子树大小,记为size[u],这个DFS一遍就可以求出来; 接下来,dp[u]表示给以u为根的子树size[u]个编号有几种编号方案 ; 然后考虑转移方程: 比如一个结点u有3个儿子v1,v2,v3,那么u子树有size[u

2017-03-29 16:39:29 417

转载 Wooden Signs uvalive gym 区间dp

详细题目见:http://7xjob4.com1.z0.glb.clouddn.com/0f10204481da21e62f8c145939e5828e 思路:记dp[i][j]表示第i个木板尾部在j的方案数。那么对于i+1,可以分三种情况讨论,一种是i+1的头部在第i根整段的左边,一种是在右边,还有在中间,中间的有两种情况,其他都只有一种,然后就可以转移了。 转载 http://blog.cs

2017-03-29 10:44:05 375

原创 Sheldon Numbers (暴力枚举)

一开始想到是暴力构造 但是题没读懂。还好队友读懂了。今天自己写了个 发现还挺好写的。改了几个点过了。#include <bits/stdc++.h>using namespace std;typedef long long ll;set<ll> s;void gouzao (int x,int y){ ll res=0; for(int i=0;i<x;i++)

2017-03-28 14:08:48 728

原创 GYM 101128 A.Promotions(dfs)

给出一张n个点的有向图表示一家有n个员工的公司的隶属图,u->v表示u是v的上司,现在老板要提拔一些人,但是规定如果一个员工被提拔,那么他的上司也要被提拔,现给出两个整数a和b表示一区间,求三个值,第一个值表示如果提拔a个人那么这n个中必须要被提拔的人数,第二个值表示如果提拔b个人那么这n个人中必须要被提拔的人数,第三个值表示就算提拔b个人也不会被提拔的人数 Input 第一行四个整数n,m

2017-03-28 01:38:32 412

原创 51nod 1189 阶乘分数 (分解质因子加上逆元,乘法逆元基本意思)

1/N! = 1/X + 1/Y(0 < x<=y),给出N,求满足条件的整数解的数量。例如:N = 2,1/2 = 1/3 + 1/6,1/2 = 1/4 + 1/4。由于数量可能很大,输出Mod 10^9 + 7。大神的代码这里仅仅是为了保存下来。。#include <map>#include <set>#include <cmath>#include <ctime>#include <

2017-03-25 19:25:30 1076 1

原创 ural 2070 Interesting Numbers(数论基础)

Nikolay and Asya investigate integers together in their spare time. Nikolay thinks an integer is interesting if it is a prime number. However, Asya thinks an integer is interesting if the amount of its

2017-03-24 20:51:06 469

原创 Xiongnu's Land (线性扫描,二分)

Wei Qing (died 106 BC) was a military general of the Western Han dynasty whose campaigns against the Xiongnu earned him great acclaim. He was a relative of Emperor Wu because he was the younger half-

2017-03-24 17:10:32 795

原创 ural 2067 Friends and Berries 数学推理

熟悉的数学定理 两边之和大于第三边 必然被不成三角形,而且是对于每一个点,都要有这样的结论,所以先排序然后所有的点都在同一边上即可#include <bits/stdc++.h>using namespace std;struct node{ int x,y; int id;}s[301010];int cmp(node a,node b){ if(a.x==b.

2017-03-23 16:08:26 446

原创 Kirill the Gardener 3 URAL 2072

Kirill the gardener has got a new task. He has to water the flowers growing on the huge flowerbed! It should be mentioned that the bed is very long and narrow at the same time. So from bird’s-eye view

2017-03-23 16:06:27 1020

原创 ural 2073(一些c++的应用)

ikolay has decided to become the best programmer in the world! Now he regularly takes part in various programming contests, attentively listens to problems analysis and upsolves problems. But the point

2017-03-22 11:03:16 723

原创 矩阵快速幂优化递推式 例:斐波那契数列 poj 3070

转载http://blog.csdn.net/g_congratulation/article/details/52734306 注意边界就好 习惯的模板就是直接来

2017-03-21 16:26:36 413

原创 codeforces 185A 矩阵快速幂

Dwarfs have planted a very interesting plant, which is a triangle directed “upwards”. This plant has an amusing feature. After one year a triangle plant directed “upwards” divides into four triangle pl

2017-03-21 15:55:14 446

原创 CF551C GukiZ hates Boxes 二分

Professor GukiZ is concerned about making his way to school, because massive piles of boxes are blocking his way.In total there are n piles of boxes, arranged in a line, from left to right, i-th pile (

2017-03-20 11:26:59 550

原创 codeforces MUH and Cube Walls (kmp)

Polar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started making cube towers by placing the cubes

2017-03-19 12:18:30 603

原创 codeforces Bear and Different Names

In the army, it isn’t easy to form a group of soldiers that will be effective on the battlefield. The communication is crucial and thus no two soldiers should share a name (what would happen if they go

2017-03-19 12:11:28 516

原创 codeforces Bear and Friendship Condition

Bear Limak examines a social network. Its main functionality is that two members can become friends (then they can talk with each other and share funny pictures).There are n members, numbered 1 through

2017-03-19 12:00:01 543

原创 Renting Bikes 二分

做了两次还是错 我宛如一个智障 A group of n schoolboys decided to ride bikes. As nobody of them has a bike, the boys need to rent them.The renting site offered them m bikes. The renting price is different for differ

2017-03-19 11:54:52 456

原创 Proxy 最短路 反向建图

感觉自己越来越菜了。 Problem DescriptionBecause of the GFW (Great Firewall), we cannot directly visit many websites, such as Facebook, Twitter, YouTube, etc. But with the help of proxy and proxy server, we can

2017-03-19 11:44:54 422

原创 Can you answer these queries? hdu 4027

A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of endu

2017-03-16 16:50:10 369

原创 Count the Colors 数颜色 离散化+线段树

Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segments of different colors you can see at last.InputT

2017-03-16 16:43:33 556

原创 hdu 1754 I hate it (线段树)

很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。 这让很多学生很反感。 不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。 Input 本题目包含多组测试,请处理到文件结束。 在每个测试的第一行,有两个正整数 N 和 M ( 0#include <conio.h>#include

2017-03-16 16:33:19 302

原创 codeforces Anton and Fairy Tale

C. Anton and Fairy Tale time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Anton likes to listen to fairy tales, especially when Danik, Anton’

2017-03-16 09:29:03 376

原创 Can you answer these queries II 线段树(区间的区间更新)

Being a completist and a simplist, kid Yang Zhe cannot solve but get Wrong Answer from most of the OI problems. And he refuse to write two program of same kind at all. So he always failes in contests.W

2017-03-13 20:49:52 580

转载 codeforces Plant Tree

include

2017-03-12 01:25:23 346

原创 Locked Treasures(组合数学思维)uva 6873

A group of n (1 ≤ n ≤ 30) bandits hid their stolen treasure in a room. The treasure needs to be locked away until there is a need to retrieve it. Since the bandits do not trust each other, they wanted

2017-03-11 18:47:25 675

原创 codeforces Coloring Brackets

Once Petya read a problem about a bracket sequence. He gave it much thought but didn’t find a solution. Today you will face it.You are given string s. It represents a correct bracket sequence. A correc

2017-03-11 00:31:50 353

原创 cf 367B Sereja ans Anagrams

Sereja has two sequences a and b and number p. Sequence a consists of n integers a1, a2, …, an. Similarly, sequence b consists of m integers b1, b2, …, bm. As usual, Sereja studies the sequences he has

2017-03-11 00:27:59 401

原创 codeforces Sereja and Algorithm

Sereja loves all sorts of algorithms. He has recently come up with a new algorithm, which receives a string as an input. Let’s represent the input string of the algorithm as q = q1q2… qk. The algorithm

2017-03-11 00:22:18 310

原创 Matrices with XOR property

Imagine A is a NxM matrix with two basic properties1) Each element in the matrix is distinct and lies in the range of 1<=A[i][j]<=(N*M)2) For any two cells of the matrix, (i1,j1) and (i2,j2), if (i1^j1

2017-03-11 00:14:51 335

原创 codeforces XOR and Favorite Number (莫队分块)

Bob has a favorite number k and ai of length n. Now he asks you to answer m queries. Each query is given by a pair li and ri and asks you to count the number of pairs of integers i and j, such that l ≤

2017-03-10 23:28:18 400

原创 codeforces Dima and Salad

You helped Dima to have a great weekend, but it’s time to work. Naturally, Dima, as all other men who have girlfriends, does everything wrong.Inna and Dima are now in one room. Inna tells Dima off for

2017-03-08 13:09:49 340

原创 蓝桥 表达式计算

问题描述   输入一个只包含加减乖除和括号的合法表达式,求表达式的值。其中除表示整除。 输入格式   输入一行,包含一个表达式。 输出格式   输出这个表达式的值。 样例输入 1-2+3*(4-5) 样例输出 -4 数据规模和约定   表达式长度不超过100,表达式运算合法且运算过程都在int内进行。#include <bits/stdc++.h>using namespac

2017-03-08 12:55:09 456

原创 codeforces Dima and Trap Graph

Dima and Inna love spending time together. The problem is, Seryozha isn’t too enthusiastic to leave his room for some reason. But Dima and Inna love each other so much that they decided to get criminal

2017-03-08 00:54:26 408

原创 codeforces D. Innokenty and a Football League

time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Innokenty is a president of a new football league in Byteland. The first task he should do

2017-03-07 10:17:30 421

原创 codeforces Jzzhu and Cities

昨天训练赛感觉跟吃了翔一样。做了两题都没做出来。 题意: 整个城市有m条公路,和k条铁路,让你求可以删除多少条铁路,但是所有城市的最短距离不能变。一开始的想法就是如果最短路里面包含有铁路,那么就是不可以删除,但是不会实现,后来看到有一个队通过先最短路公路再最短路铁路,居然卡过了!!!!!!!!!害我也学他们弄了好久还是卡不过,今天看了看别人的题解,看到了一开始想法的实现,比较麻烦,入队的不仅是nd

2017-03-06 15:35:42 397

原创 codeforces The Meeting Place Cannot Be Changed

The main road in Bytecity is a straight line from south to north. Conveniently, there are coordinates measured in meters from the southernmost building in north direction.At some points on the road the

2017-03-06 10:16:54 455

原创 Codeforces Andryusha and Colored Balloons

题意 给定点数和边数,使任意相连的三个点颜色不一样。 dfs:每次把所到点的每条边的点都染上,而且要与上一个点和上上个点颜色不一样即可。#include <bits/stdc++.h>using namespace std;vector<int> v[201000];int num;int n;int c[201000];void dfs(int x,int f){ int

2017-03-06 10:12:21 366

空空如也

空空如也

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

TA关注的人

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