自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 C语言与陷阱

第一章 词法陷阱1.1 if (x = y)相当于将y的值赋给x,然后检查该值是否为零 如果将比较运算符==写成赋值运算符=,因为赋值运算符=优先级低于逻辑运算符||,其结果相当于把右侧表达式的值赋值给左值 1.2 &和|是位运算符,&&和||是逻辑运算符 1.3 C编译器读入字符使用贪心法,从左到右一个一个读入,判断已读入...

2018-04-30 13:56:25 1794

原创 剑指OFFER11-20

11.二进制中1的个数输入一个整数,输出该数二进制表示中1的个数。其中负数用补码表示。class Solution {public: int NumberOf1(int n) { int cot=0; if(n<0) { n+=2147483648; cot++; ...

2018-02-20 23:59:07 163

原创 剑指OFFER第1-10题

1.二维数组中的查找在一个二维数组中,每一行都按照从左到右递增的顺序排序,每一列都按照从上到下递增的顺序排序。请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。class Solution {public: bool Find(int target, vector<vector<int> > array) { ve...

2018-02-19 17:18:25 268

原创 Codeforces 652D Nested Segments 树状数组离线处理

You are given n segments on a line. There are no ends of some segments that coincide. For each segment find the number of segments it contains.Input The first line contains a single integer n (1 ≤ n ≤

2017-11-15 21:57:18 377

原创 Educational Codeforces Round 10C Foe Pairs

You are given a permutation p of length n. Also you are given m foe pairs (ai, bi) (1 ≤ ai, bi ≤ n, ai ≠ bi).Your task is to count the number of different intervals (x, y) (1 ≤ x ≤ y ≤ n) that do not c

2017-11-15 21:46:36 293

原创 Longest Subsequence CodeForces 632D 数学/筛法

You are given array a with n elements and the number m. Consider some subsequence of a and the value of least common multiple (LCM) of its elements. Denote LCM as l. Find any longest subsequence of a w

2017-11-08 16:57:34 211

原创 The Smallest String Concatenation CodeForces 632C 字符串

You’re given a list of n strings a1, a2, …, an. You’d like to concatenate them together in some order such that the resulting string would be lexicographically smallest.Given the list of strings, outpu

2017-11-08 15:47:30 219

原创 狼抓兔子 BZOJ1001 平面图最小割转对偶图最短路

现在小朋友们最喜欢的”喜羊羊与灰太狼”,话说灰太狼抓羊不到,但抓兔子还是比较在行的, 而且现在的兔子还比较笨,它们只有两个窝,现在你做为狼王,面对下面这样一个网格的地形:左上角点为(1,1),右下角点为(N,M)(上图中N=4,M=5).有以下三种类型的道路 1:(x,y)<==>(x+1,y) 2:(x,y)<==>(x,y+1) 3:(x,y)<==>(x+1,y+1) 道路上

2017-11-07 22:01:49 322

原创 Anton and Chess CodeForces - 734D 模拟

Anton likes to play chess. Also, he likes to do programming. That is why he decided to write the program that plays chess. However, he finds the game on 8 to 8 board to too simple, he uses an infinite

2017-11-05 17:11:55 247

原创 Maximal GCD CodeForces - 803C

You are given positive integer number n. You should create such strictly increasing sequence of k positive numbers a1, a2, …, ak, that their sum is equal to n and greatest common divisor is maximal.Gre

2017-11-05 17:02:35 248

原创 Radar Installation POJ - 1328 贪心

Assume the coasting is an infinite straight line. Land is in one side of coasting, sea in the other. Each small island is a point locating in the sea side. And any radar installation, locating on the c

2017-11-05 16:41:23 215

原创 Mike and Shortcuts CodeForces - 689B BFS

Recently, Mike was very busy with studying for exams and contests. Now he is going to chill a bit by doing some sight seeing in the city.City consists of n intersections numbered from 1 to n. Mike star

2017-11-05 16:24:55 192

原创 你经历过绝望吗?两次! CSU - 1726 BFS

4月16日,日本熊本地区强震后,受灾严重的阿苏市一养猪场倒塌,幸运的是,猪圈里很多头猪依然坚强存活。当地15名消防员耗时一天解救围困的“猪坚强”。不过与在废墟中靠吃木炭饮雨水存活36天的中国汶川“猪坚强”相比,熊本的猪可没那么幸运,因为它们最终还是没能逃过被送往屠宰场的命运。 我们假设“猪坚强”被困在一个N*M的废墟中,其中“@”表示“猪坚强”的位置,“.”表示可以直接通过的空地,“#”表示不

2017-11-05 16:18:59 257

原创 Prime Path POJ - 3126 BFS

The ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a matter of

2017-11-05 16:11:59 154

原创 201703-4 地铁修建 最短路

问题描述   A市有n个交通枢纽,其中1号和n号非常重要,为了加强运输能力,A市决定在1号到n号枢纽间修建一条地铁。   地铁由很多段隧道组成,每段隧道连接两个交通枢纽。经过勘探,有m段隧道作为候选,两个交通枢纽之间最多只有一条候选的隧道,没有隧道两端连接着同一个交通枢纽。   现在有n家隧道施工的公司,每段候选的隧道只能由一个公司施工,每家公司施工需要的天数一致。而每家公司最多只

2017-11-04 15:54:37 219

原创 201703-3 Markdown

问题描述

2017-11-04 14:58:28 217

原创 Zbazi in Zeydabad CodeForces - 628E 树状数组

A tourist wants to visit country Zeydabad for Zbazi (a local game in Zeydabad). The country Zeydabad is a rectangular table consisting of n rows and m columns. Each cell on the country is either ‘z’

2017-11-03 23:25:40 330

原创 Line belt HDU - 3400 三分

In a two-dimensional plane there are two line belts, there are two segments AB and CD, lxhgww’s speed on AB is P and on CD is Q, he can move with the speed R on other area on the plane. How long mu

2017-11-02 23:32:00 158

原创 Toxophily HDU - 2298 三分/二分

The recreation center of WHU ACM Team has indoor billiards, Ping Pang, chess and bridge, toxophily, deluxe ballrooms KTV rooms, fishing, climbing, and so on. We all like toxophily. Bob is hooke

2017-11-02 23:14:35 228

原创 Texas Trip POJ - 3301 三分

After a day trip with his friend Dick, Harry noticed a strange pattern of tiny holes in the door of his SUV. The local American Tire store sells fiberglass patching material only in square sheets. What

2017-11-02 23:05:54 269

原创 Strange fuction HDU - 2899

Now, here is a fuction: F(x) = 6 * x^7+8*x^6+7*x^3+5*x^2-y*x (0 <= x <=100) Can you find the minimum value when x is between 0 and 100. Input The first line of the input contains an int

2017-11-02 22:55:54 149

原创 SGU 507 Treediff 启发式合并

Andrew has just made a breakthrough in complexity theory: he thinks that he can prove P=NP if he can get a data structure which allows to perform the following operation quickly. Naturally, you should

2017-11-02 22:48:46 444

原创 HDU1512 Monkey King 左偏树

Once in a forest, there lived N aggressive monkeys. At the beginning, they each does things in its own way and none of them knows each other. But monkeys can’t avoid quarrelling, and it only happens be

2017-11-02 21:03:38 221

原创 CCF201709-5 除法 树状数组

问题描述  小葱喜欢除法,所以他给了你N个数a1, a2, ⋯, aN,并且希望你执行M次操作,每次操作可能有以下两种:   给你三个数l, r, v,你需要将al, al+1, ⋯, ar之间所有v的倍数除以v。   给你两个数l, r,你需要回答al + al+1 + ⋯ + ar的值是多少。输入格式  第一行两个整数N, M,代表数的个数和操作的次数。   接下来一行N个整数,代表N个数

2017-11-02 18:00:07 401

原创 ccf 201709-4 通信网络 BFS遍历

问题描述

2017-11-02 00:31:49 458

原创 Codeforces 628D Magic Numbers 数位DP

Consider the decimal presentation of an integer. Let’s call a number d-magic if digit d appears in decimal presentation of the number on even positions and nowhere else.For example, the numbers 1727374

2017-11-01 23:04:05 299

原创 CCF201709-3 JSON查询

问题描述  JSON (JavaScript Object Notation) 是一种轻量级的数据交换格式,可以用来描述半结构化的数据。JSON 格式中的基本单元是值 (value),出于简化的目的本题只涉及 2 种类型的值:   * 字符串 (string):字符串是由双引号 ” 括起来的一组字符(可以为空)。如果字符串的内容中出现双引号 “,在双引号前面加反斜杠,也就是用 \” 表示;如果出现

2017-11-01 13:20:59 3176 1

原创 APIO2012 Dispatching 左偏树

左偏树

2017-10-30 22:47:06 175

原创 PAT甲级1131. Subway Map 最短路/bfs

In the big cities, the subway systems always look so complex to the visitors. To give you some sense, the following figure shows the map of Beijing subway. Now you are supposed to help people with your

2017-10-30 22:24:32 376

原创 PAT甲级1135 Is It A Red-Black Tree

There is a kind of balanced binary search tree named red-black tree in the data structure. It has the following 5 properties:(1) Every node is either red or black. (2) The root is black. (3) Every le

2017-10-23 23:18:06 235

原创 HDU 4417 Super Mario(线段树离线处理/主席树)

Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is in trouble again and Mario needs to save his lover. We regard the road to

2017-10-22 23:02:48 242

原创 HDU 2665 Kth number 可持久化线段树

Give you a sequence and ask you the kth big number of a inteval.Input The first line is the number of the test cases. For each test case, the first line contain two integer n and m (n, m <= 1000

2017-10-22 22:47:58 206

原创 Freedom of Choice URAL - 1517

Background Before Albanian people could bear with the freedom of speech (this story is fully described in the problem “Freedom of speech”), another freedom - the freedom of choice - came down on them

2017-10-21 00:33:21 212

原创 Palindrome URAL - 1297

The “U.S. Robots” HQ has just received a rather alarming anonymous letter. It states that the agent from the competing «Robots Unlimited» has infiltrated into “U.S. Robotics”. «U.S. Robots» security se

2017-10-20 22:21:25 177

原创 Distinct Substrings SPOJ - DISUBSTR

Given a string, we need to find the total number of its distinct substrings.Input T- number of test cases. T<=20; Each test case consists of one string, whose length is <= 1000Output For each

2017-10-20 16:54:10 197

原创 国庆出游 HihoCoder - 1041

小Hi和小Ho准备国庆期间去A国旅游。A国的城际交通比较有特色:它共有n座城市(编号1-n);城市之间恰好有n-1条公路相连,形成一个树形公路网。小Hi计划从A国首都(1号城市)出发,自驾遍历所有城市,并且经过每一条公路恰好两次——来回各一次——这样公路两旁的景色都不会错过。 令小Hi苦恼的是他的小伙伴小Ho希望能以某种特定的顺序游历其中m个城市。例如按3-2-5的顺序游历这3座城市。(具体来

2017-10-15 23:35:45 427

原创 The Settlers of Catan POJ - 2258

Within Settlers of Catan, the 1995 German game of the year, players attempt to dominate an island by building roads, settlements and cities across its uncharted wilderness. You are employed by a so

2017-10-15 23:15:46 223

原创 Square HDU - 1518

Given a set of sticks of various lengths, is it possible to join them end-to-end to form a square? Input The first line of input contains N, the number of test cases. Each test case begins with an i

2017-10-15 23:11:08 188

原创 Twenty-four point CSU - 1600

Given four numbers, can you get twenty-four through the addition, subtraction, multiplication, and division? Each number can be used only once.Input The input consists of multiple test cases. Each t

2017-10-15 22:08:00 183

原创 Glass Carving CodeForces - 527C

Leonid wants to become a glass carver (the person who creates beautiful artworks by cutting the glass). He already has a rectangular w mm  ×  h mm sheet of glass, a diamond glass cutter and lots of ent

2017-10-15 21:49:33 383

空空如也

空空如也

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

TA关注的人

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