自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 A. Slightly Decreasing Permutations

#include #include #include #include using namespace std;int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF) { if(m==0) { for(int i=1;i<n;i++)

2014-03-31 18:44:00 628

原创 cf——B. Garland

Once little Vasya read an article in a magazine on how to make beautiful handmade garland from colored paper. Vasya immediately went to the store and bought n colored sheets of paper, the area of ea

2014-03-30 18:31:31 649

原创 cf——H - Vanya and Cards

The Little Elephant has an integer a, written in the binary notation. He wants to write this number on a piece of paper.To make sure that the number a fits on the piece of paper, the Little Elepha

2014-03-30 08:48:11 573

原创 C. Hexadecimal's Numbers

One beautiful July morning a terrible thing happened in Mainframe: a mean virus Megabyte somehow got access to the memory of his not less mean sister Hexadecimal. He loaded there a huge amount of n di

2014-03-27 16:35:18 948

原创 A. Kalevitch and Chess

A famous Berland's painter Kalevitch likes to shock the public. One of his last obsessions is chess. For more than a thousand years people have been playing this old game on uninteresting, monotonous

2014-03-27 13:06:13 972

原创 cf——B. Domino Effect

Little Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to play withthe dominoes and make a "domino show".Chris arranges n d

2014-03-27 12:46:35 513

原创 cf——A. Unusual Product

Little Chris is a huge fan of linear algebra. This time he has been given a homework about the unusual square of a square matrix.The dot product of two integer number vectors x and y of size n i

2014-03-27 11:39:31 467

原创 c++运算符

C/C++位操作运算符操作符功能用法~位求反~expr左移expr1 >>右移expr1 >> expr2&位与expr1 & expr2^位异或expr1 ^ expr2|位或

2014-03-27 08:49:51 449

原创 A. Gravity Flip(水 sort)

Little Chris is bored during his physics lessons (too easy), so he has built a toy box to keep himself occupied. The box is special, since it has the ability to change gravity.There are n columns

2014-03-27 08:10:14 582

原创 poj——2502——Subway

DescriptionYou have just moved from a quiet Waterloo neighbourhood to a big, noisy city. Instead of getting to ride your bike to school every day, you now get to walk and take the subway. Because

2014-03-25 12:23:32 551

原创 LCA&RMQ

LCA问题(Tarjan算法)LCA:基于有根树最近公共祖先问题LCA(T,u,v):在有根树T中,询问一个距离根最远的结点x,使得x同时为结点u、v的祖先       RMQ问题(ST算法)RMQ:区间最小值询问问题RMQ(A,i,j):对于线性序列A中,询问区间[i,j]上的最小值特别的,若线性序列A任意两相邻元素相差为±1,那么建立在A上的RMQ称为±1RMQ

2014-03-24 20:03:43 579

原创 poj——1986——Distance Queries

DescriptionFarmer John's cows refused to run in his marathon since he chose a path much too long for their leisurely lifestyle. He therefore wants to find a path of a more reasonable length. The i

2014-03-24 19:46:25 523

原创 poj——1985——Cow Marathon

DescriptionAfter 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 maratho

2014-03-24 12:21:51 530

原创 曼哈顿距离和欧氏距离比较

曼哈顿距离是由十九世纪的赫尔曼·闵可夫斯基所创词汇 ,是种使用在几何度量空间的几何学用语,用以标明两个点在标准坐标系上的绝对轴距总和。出租车几何或曼哈顿距离(Manhattan Distance)是由十九世纪的赫尔曼·闵可夫斯基所创词汇 ,是种使用在几何度量空间的几何学用语,用以标明两个点在标准坐标系上的绝对轴距总和。图中红线代表曼哈顿距离,绿色代表欧氏距离,也就是直线距离,而蓝色

2014-03-24 11:16:01 9075 1

原创 A. Valera and X

Valera is a little boy. Yesterday he got a huge Math hometask at school, so Valera didn't have enough time to properly learn the English alphabet for his English lesson. Unfortunately, the English tea

2014-03-20 13:45:29 648

原创 poj——1679——The Unique MST(树+dp)

DescriptionGiven a connected undirected graph, tell if its minimum spanning tree is unique. Definition 1 (Spanning Tree): Consider a connected, undirected graph G = (V, E). A spanning tree of G

2014-03-19 22:47:22 529

原创 poj——2031——Building a Space Station

DescriptionYou are a member of the space station engineering team, and are assigned a task in the construction process of the station. You are expected to write a computer program to complete the

2014-03-18 17:39:52 467

原创 poj——2255——Tree Recovery

DescriptionLittle Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with capital letters in the nodes. This is an example of o

2014-03-18 16:00:17 442

原创 poj——2438——Children's Dining

DescriptionUsually children in kindergarten like to quarrel with each other. This situation annoys the child-care women. For instant, when diner time comes, a fierce conflict may break out when a

2014-03-18 15:09:12 535

原创 cf——236——A. Nuts

You have a nuts and lots of boxes. The boxes have a wonderful feature: if you put x (x ≥ 0) divisors (the spacial bars that can divide a box) to it, you get a box, divided into x + 1 sections.Yo

2014-03-17 11:10:10 572

原创 hdu——2603——0 or 1

Problem DescriptionSolving problem is a interesting thing. Yifenfei like to slove different problem,because he think it is a way let him more intelligent. But as we know,yifenfei is weak in math. Wh

2014-03-16 22:38:35 797 2

原创 B - An easy problem

DescriptionWhen Teddy was a child , he was always thinking about some simple math problems ,such as “What it’s 1 cup of water plus 1 pile of dough ..” , “100 yuan buy 100 pig” .etc..One day Tedd

2014-03-16 22:36:24 577

原创 hdu——2603——Wiskey's Power

Problem DescriptionCome back school from the 33rdACM / ICPC Asia ChenDu, everyone is exhausted, in particular the captain Wiskey. As saying that night, Wiskey drink a lot of wine, just as he blurred

2014-03-16 22:34:08 653

原创 A. George and Sleep

George woke up and saw the current time s on the digital clock. Besides, George knows that he has slept for time t.Help George! Write a program that will, given time s and t, determine the time 

2014-03-14 14:47:14 607

原创 B. Sereja and Contests

Sereja is a coder and he likes to take part in Codesorfes rounds. However, Uzhland doesn't have good internet connection, so Sereja sometimes skips rounds.Codesorfes has rounds of two types: Div1 

2014-03-11 16:33:29 681

原创 A. Vanya and Cards

Vanya loves playing. He even has a special set of cards to play with. Each card has a single integer. The number on the card can be positive, negative and can even be equal to zero. The only limit is,

2014-03-11 15:55:25 636

原创 链式前向星(图)

#include #include using namespace std;const int M=1005;int head[M];struct node{ int to; int w; int next;}Node[M];int main(){ int n,m; cin>>n>>m; memset(head,-1,size

2014-03-11 15:17:09 653

原创 hdu——1686——Oulipo

Problem DescriptionThe French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book:Tout avait Pa

2014-03-11 15:14:57 442

原创 D - Colour sequence

DescriptionWe have a pile of cards consisting of 100 cards that are coloured on both sides. There is a finite number of colours (at most 26). In addition there are special cards called jokers. Joker

2014-03-11 15:09:58 602

原创 A. Inna and Choose Options

There always is something to choose from! And now, instead of "Noughts and Crosses", Inna choose a very unusual upgrade of this game. The rules of the game are given below:There is one person pl

2014-03-08 21:25:42 634

原创 B. Inna and New Matrix of Candies

Inna likes sweets and a game called the "Candy Matrix". Today, she came up with the new game "Candy Matrix 2: Reload".The field for the new game is a rectangle table of size n × m. Each line of th

2014-03-08 20:39:50 954

原创 C. Inna and Huge Candy Matrix(cf)

Inna and Dima decided to surprise Sereja. They brought a really huge candy matrix, it's big even for Sereja! Let's number the rows of the giant matrix from 1 to n from top to bottom and the columns

2014-03-07 15:55:13 933

原创 B - Calculate S(n)

DescriptionCalculate S(n). S(n)=1^3+2^ 3 +3 ^3 +......+n^ 3 .InputEach line will contain one integer N(1 OutputFor each case, output the last four dights of S(N) in one line.

2014-03-06 15:58:32 1099 2

原创 hdu——2115——C - I Love This Game( 比赛)

DescriptionDo you like playing basketball ? If you are , you may know the NBA Skills Challenge . It is the content of the basketball skills . It include several parts , such as passing , shooting ,

2014-03-06 15:53:33 582

原创 sscanf 把字符串分别拆成两部分

sscanf(s,"%s %s",s1,s2);  遇到空格时候拆开

2014-03-05 21:31:25 1090

转载 C/C++中int/long/float/double数值类型与字符串互相转换[总结]

memcpy方法可以实现将int等保存到字符类型的数组中。示例: long    long_data=-9828;        unsigned char data[4]; memcpy(data,&t,4); //将long类型的数据用4个char保存。 long my_long_data=0; memcpy(&tt,data,4);//

2014-03-05 21:25:40 855

原创 hdu ——1159——Common Subsequence

Problem DescriptionA subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = another sequence Z = is a subsequence of X if there exi

2014-03-04 21:18:10 475

原创 hdu——1080——Human Gene Functions

Problem DescriptionIt is well known that a human gene can be considered as a sequence, consisting of four nucleotides, which are simply denoted by four letters, A, C, G, and T. Biologists have been

2014-03-04 18:24:54 475

转载 动态规划之最长公共子序列

下面这篇文章介绍一下在算法设计中动态规划的最长公共子序列的问题。最长公共子序列问题所谓,也即是分别给出长度为n和m的字符串A,B,然后找出其中最长公共子序列的最优值和最优解。所谓最优值,也就是求出这个最长公共子序列的长度;而最优解,就是要求出这个最长最长公共子序列是什么的问题。给个不太恰当的例子:我们中学数学中经常会遇到求函数最值的问题,比如说求出函数 f(x) 的最大值,那么这个

2014-03-04 17:09:39 528

原创 poj——2856——Y2K Accounting Bug

DescriptionAccounting for Computer Machinists (ACM) has sufferred from the Y2K bug and lost some vital data for preparing annual report for MS Inc. All what they remember is that MS Inc. posted

2014-03-03 19:43:28 662

空空如也

空空如也

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

TA关注的人

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