自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 强连通图和双连通图

刚刚弄明白了强连通和双连通,我好菜啊。。TUT两道差不多的题目,POJ - 3177 和计蒜客的Islandspoj-3177 给出很多边,问添加最少多少条边成为一个双连通Islands 变成强连通强连通:图中任意两个节点可以相互通达双连通:图中任意两个节点之间都有两条路POJ-3177 跑一遍Tarjan 所有的双连通块看做一个点,将整个图看做一棵树,把整棵树的叶子节

2017-09-15 19:59:10 3412

原创 HDU - 1024 Max Sum Plus Plus

本题是连续最大子序列和的加强版。题目大意为 从一序列中取出若干段,使得这几段的和最大.不得不说。。DP真的好难啊→ →基本的连续最大子序列和代码为#include#include#includeusing namespace std;int a[1234];int main(){ int n; while(~scanf("%d",&n))

2017-06-26 20:22:28 406

原创 基础DP学习之【货币问题】

问题 D: 【动态规划】货币面值时间限制: 1 Sec  内存限制: 64 MB提交: 16  解决: 14[提交][状态][讨论版]题目描述魔法世界发行了很多不同面值的纸币,试求出用这些纸币进行任意的组合不能表示的最小面值是多少。输入输入包含多个测试用例,每组测试用例的第一行输入一个整数N(N≤100)表示流通的纸币面额数量,第二行是N个纸币的具体表示面额,取值范围为

2017-06-25 20:42:51 691

原创 基础DP学习之【数的划分】

题目描述 Description将整数n分成k份,且每份不能为空,任意两种划分方案不能相同(不考虑顺序)。例如:n=7,k=3,下面三种划分方案被认为是相同的。1 1 51 5 15 1 1问有多少种不同的分法。输入描述 Input Description输入:n,k (6输出描述 Output Description

2017-06-25 19:12:39 322

原创 Max Sum Plus Plus HDU - 1024

Now I think you have got an AC in Ignatius.L's "Max Sum" problem. To be a brave ACMer, we always challenge ourselves to more difficult problems. Now you are faced with a more difficult problem. Gi

2017-06-13 13:34:48 184

原创 POJ-3159 Candies

During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse’s class a large bag of candies and had flymouse distribute them. All the

2017-06-12 17:49:29 183

原创 POJ-1511 Invitation Cards

In the age of television, not many people attend theater performances. Antique Comedians of Malidinesia are aware of this fact. They want to propagate theater and, most of all, Antique Comedies. They

2017-06-12 17:29:17 228

原创 poj2240 - Arbitrage

Arbitrage is the use of discrepancies in currency exchange rates to transform one unit of a currency into more than one unit of the same currency. For example, suppose that 1 US Dollar buys 0.5 Britis

2017-06-12 17:16:42 274

原创 UVA 12506 Shortest Names

In a strange village, people have very long names. For example: aaaaa, bbb and abababab. You see, it’s very inconvenient to call a person, so people invented a good way: just call a prefix of the names

2017-06-08 23:55:24 241

原创 UVA 10214 Trees in a Wood.

复制、不下、来!!= =!直接上代码好了、、phi函数是用来计算小于且与n互质的数的个数的。两个数互质,其GCD为1先用欧拉函数求出个数,在把剩下的枚举一遍就OK#include#include#includeusing namespace std;const int MAXN=2000;int phi[MAXN];int vis[MAXN];void Init(

2017-06-04 20:25:29 206

原创 POJ 3259 Wormholes

While exploring his many farms, Farmer John has discovered a number of amazing wormholes. A wormhole is very peculiar because it is a one-way path that delivers you to its destination at a time that i

2017-06-01 20:02:34 154

原创 UVA 12034 Race 动态规划+递推

Disky and Sooma, two of the biggest mega minds of Bangladesh went to a far country. They ate, codedand wandered around, even in their holidays. They passed several months in this way. But everything

2017-05-31 11:33:45 216

原创 UVA 1635 Irrelevant Elements 唯一分解定律

Young cryptoanalyst Georgie is investigating different schemes of generating random integer numbers ranging from 0 to m−1. He thinks that standard random number generators are not good enough, so he ha

2017-05-28 19:12:58 240

原创 UVA 10791 Minimum Sum LCM

LCM (Least Common Multiple) of a set of integers is defined as the minimum number, which is a multiple of all integers of that set. It is interesting to note that any positive integer can be expressed

2017-05-28 10:10:43 236

原创 UVA 10375 Choose and divide

The binomial coefficient C(m,n) is defined asC(m,n) =m! (m−n)! n! Given four natural numbers p, q, r, and s, compute the the result of dividing C(p,q) by C(r,s).·InputInput consists of a sequence

2017-05-27 21:47:34 257

原创 HDU 1043 Eight A*算法+康托展开

The 15-puzzle has been around for over 100 years; even if you don't know it by that name, you've seen it. It is constructed with 15 sliding tiles, each with a number from 1 to 15 on it, and all packed

2017-05-27 16:37:41 457

原创 UVA 11528 Colossal Fibonacci Numbers! 数学,幂取模,循环节,

题目实在是复制不过来了。。2的64次方是unsigned long long 的最大值,输入输出用%llu,用%I64u不知道为什么会WA...TvT通过对n=2,3,4……打表发现,每次都会有一个循环节出现,所以每次循环到0和1的时候即为一个新的循环节。用vector动态数组存正好可以AC代码:#include#include#include#includeusing

2017-05-26 20:30:09 293

原创 HDU 1506 DNA sequence IDA*

The twenty-first century is a biology-technology developing century. We know that a gene is made of DNA. The nucleotide bases from which DNA is built are A(adenine), C(cytosine), G(guanine), and T(thy

2017-05-24 16:37:44 199

原创 HDU 3533 Escape

The students of the HEU are maneuvering for their military training. The red army and the blue army are at war today. The blue army finds that Little A is the spy of the red army, so Little A has to

2017-05-24 15:36:38 205

原创 HDU 3001 Travelling

After coding so many days,Mr Acmer wants to have a good rest.So travelling is the best choice!He has decided to visit n cities(he insists on seeing all the cities!And he does not mind which city being

2017-05-23 20:57:37 172

原创 UVA 12100 Printer Queue

12100  Printer QueueInput   One line with a positive integer :  the number of test cases(at most 100).  Then for each test case:   • One line with two integers n and m, where n is the number

2017-05-22 08:49:16 232

原创 UVA 1594 Ducci Sequence

Ducci SequenceTime Limit:3000MS     Memory Limit:0KB     64bit IO Format:%lld & %llu DescriptionA Ducci sequence is a sequence of n-tuples of integers. Given an n-tuple of integers (a1, a2, ..

2017-05-21 20:42:37 245

原创 UVA 400 Unix ls

Unix ls The computer company you work for is introducing a brand new computer line and is developing a new Unix-like operating system to be introduced along with the new computer. Your assignm

2017-05-21 19:40:15 275

原创 POJ 3984 迷宫问题

定义一个二维数组: int maze[5][5] = { 0, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0,};它表示一个迷宫,其中的1表示墙壁,0表示可以走的路,只能横着走或竖着走,不能斜着走,要求编程序找出从左上角到右下角的最短路线。 Input一个5 ×

2017-05-21 16:11:27 123

原创 POJ 1321 棋盘问题

在一个给定形状的棋盘(形状可能是不规则的)上面摆放棋子,棋子没有区别。要求摆放时任意的两个棋子不能放在棋盘中的同一行或者同一列,请编程求解对于给定形状和大小的棋盘,摆放k个棋子的所有可行的摆放方案C。Input输入含有多组测试数据。 每组数据的第一行是两个正整数,n k,用一个空格隔开,表示了将在一个n*n的矩阵内描述棋盘,以及摆放棋子的数目。 n 当为-1 -1时表示输入结束。

2017-05-21 15:56:17 165

原创 FZU 2140 Forever 0.5

Given an integer N, your task is to judge whether there exist N points in the plane such that satisfy the following conditions:1. The distance between any two points is no greater than 1.0.2. The

2017-05-21 11:10:44 182

原创 FZU 2148 Moon Game(线性代数,几何)

Fat brother and Maze are playing a kind of special (hentai) game in the clearly blue sky which we can just consider as a kind of two-dimensional plane. Then Fat brother starts to draw N starts in the

2017-05-20 21:26:55 245

原创 HDU 2102 A计划

可怜的公主在一次次被魔王掳走一次次被骑士们救回来之后,而今,不幸的她再一次面临生命的考验。魔王已经发出消息说将在T时刻吃掉公主,因为他听信谣言说吃公主的肉也能长生不老。年迈的国王正是心急如焚,告招天下勇士来拯救公主。不过公主早已习以为常,她深信智勇的骑士LJ肯定能将她救出。现据密探所报,公主被关在一个两层的迷宫里,迷宫的入口是S(0,0,0),公主的位置用P表示,时空传输机用#表示,墙用*

2017-05-20 20:05:14 160

原创 POJ 3279 Fliptile

Farmer John knows that an intellectually satisfied cow is a happy cow who will give more milk. He has arranged a brainy activity for cows in which they manipulate anM × N grid (1 ≤ M ≤ 15; 1 ≤ N ≤ 1

2017-05-19 20:06:53 149

原创 POJ 2551 Dungeon Master

You are trapped in a 3D dungeon and need to find the quickest way out! The dungeon is composed of unit cubes which may or may not be filled with rock. It takes one minute to move one unit north, south

2017-05-17 15:25:28 210

原创 UVA 11624 Fire!

Joe works in a maze. Unfortunately, portions of the maze have caught on fire, and the owner of the maze neglected to create a fire escape plan. Help Joe escape the maze.Given Joe's location in the m

2017-05-15 20:39:57 160

原创 HDU 2612 Find a way

Pass a year learning in Hangzhou, yifenfei arrival hometown Ningbo at finally. Leave Ningbo one year, yifenfei have many people to meet. Especially a good friend Merceki.Yifenfei’s home is at the

2017-05-15 11:21:30 165

原创 山东省第八届省赛A题 Return of the Nim

Problem DescriptionSherlock and Watson are playing the following modified version of Nim game:There are n piles of stones denoted as ,,...,, and n is a prime number;Sherlock always plays fir

2017-05-14 16:45:58 356

原创 HDU 3951 Coin Game

After hh has learned how to play Nim game, he begins to try another coin game which seems much easier.The game goes like this: Two players start the game with a circle of n coins. They t

2017-05-14 11:24:25 233

原创 HDU 2176 取(m堆)石子游戏

m堆石子,两人轮流取.只能在1堆中取.取完者胜.先取者负输出No.先取者胜输出Yes,然后输出怎样取子.例如5堆 5,7,8,9,10先取者胜,先取者第1次取时可以从有8个的那一堆取走7个剩下1个,也可以从有9个的中那一堆取走9个剩下0个,也可以从有10个的中那一堆取走7个剩下3个.Input 输入有多组.每组第1行是m,mOutput 先取者负输出No.先取者胜输出Yes,然后输

2017-05-13 20:00:28 274

原创 HDU 2177 取(2堆)石子游戏

有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。如果你胜,你第1次怎样取子?Input 输入包含若干行,表示若干种石子的初始情况,其中每

2017-05-13 19:03:36 310

原创 HDU 2516 取石子游戏 斐波那契博弈

1堆石子有n个,两人轮流取.先取者第1次可以取任意多个,但不能全部取完.以后每次取的石子数不能超过上次取子数的2倍。取完者胜.先取者负输出"Second win".先取者胜输出"First win".Input 输入有多组.每组第1行是2Output 先取者负输出"Second win". 先取者胜输出"First win". 参看Sample Output.Sampl

2017-05-13 16:33:26 251

原创 POJ 3126 Prime Path

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-05-13 15:26:28 115

原创 POJ 1426 Find The Multiple

Given a positive integer n, write a program to find out a nonzero multiple m of n whose decimal representation contains only the digits 0 and 1. You may assume that n is not greater than 200 and there

2017-05-12 21:03:00 138

原创 任性的阿三 sdut 3528

Problem Description阿三出门游玩,遇到了一排任性的灯泡,这一排灯泡有亮有暗,而且有两个连续的灯泡坏掉了。阿三是一个环保主义者,他希望把所有的灯泡关掉之后再离开.除了端点的灯泡,每个灯泡都有唯一的一个开关,并且如果摁下pos位置上灯泡的开关,pos、pos-1和pos+1位置上的灯泡都会取反(即亮变暗、暗变亮)问题是最少需要按下多少次开关,把所有的灯泡关掉.

2017-05-04 15:14:11 232

空空如也

空空如也

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

TA关注的人

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