![](https://img-blog.csdnimg.cn/20190927151043371.png?x-oss-process=image/resize,m_fixed,h_224,w_224)
ACM-算法设计
文章平均质量分 84
逻辑算法题
_txg
平凡,是为了最美的荡气回肠
展开
-
Too Rich HDU - 5527 (思维题+贪心)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5527Too RichTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 1253 Accepted Submissi原创 2017-06-14 10:49:59 · 580 阅读 · 0 评论 -
(one day one problem)SPOJ - PROD1GCD Product it again (GCD+分解质因子找思路)-数论
题目链接:https://cn.vjudge.net/problem/477808/originThe problem is very simple. given two integers n and m, find the product GCD(1, 1) * GCD(1, 2) * ... * GCD(1, M) * GCD(2, 1) * GCD(2, 2) * ... * GCD原创 2017-04-25 17:53:47 · 800 阅读 · 0 评论 -
2017组队训练 ZOJ - 3715 Kindergarten Election (贪心)
点击一下:https://vjudge.net/problem/38590/originAt the beginning of the semester in kindergarten, the n little kids (indexed from 1 to n, for convenience) in class need to elect their new leader.T原创 2017-04-21 16:16:24 · 373 阅读 · 0 评论 -
2017省组队训练 zoj3780 Paint the Grid Again (模拟)
直击题目:点击打开链接Leo has a grid with N × N cells. He wants to paint each cell with a specific color (either black or white).Leo has a magical brush which can paint any row with black color, or any c原创 2017-04-19 13:42:50 · 329 阅读 · 0 评论 -
2017省组队训练 zoj 3385Hanami Party (贪心+栈优化)
题目链接:点击打开链接Saigyouji Yuyuko and Konpaku Youmu are going to hold a hanami party (a Japanese traditional custom of enjoying the beauty of cherry blossoms). They decide to invite all their friends原创 2017-04-19 12:27:44 · 425 阅读 · 0 评论 -
2017省选拔(二)poj3494 Largest Submatrix of All 1’s (单调栈+预处理)
直击链接:点击打开链接Given a m-by-n (0,1)-matrix, of all its submatrices of all 1’s which is the largest? By largest we mean that the submatrix has the most elements.InputThe input contains mu原创 2017-04-19 10:51:39 · 440 阅读 · 0 评论 -
2017sdut省赛选拔(1)--poj2976(基础01分数规划)
http://poj.org/problem?id=2976Dropping testsTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 11826 Accepted: 4105DescriptionIn a certain course原创 2017-04-11 16:00:57 · 450 阅读 · 0 评论 -
2017sdut省赛选拔(1)--poj3279(状态压缩+枚举)
http://poj.org/problem?id=3279FliptileTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 9642 Accepted: 3597DescriptionFarmer John knows that an原创 2017-04-11 15:52:37 · 418 阅读 · 0 评论 -
2017sdut省赛选拔(1)--poj2559(单调栈的应用)
http://poj.org/problem?id=2559Largest Rectangle in a HistogramTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 21489Accepted: 6923DescriptionA h原创 2017-04-11 11:45:06 · 491 阅读 · 0 评论 -
2017sdut省赛选拔(1)--poj2431(贪心)
http://poj.org/problem?id=2431ExpeditionTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 15367Accepted: 4311DescriptionA group of cows grabbed a原创 2017-04-11 11:34:07 · 325 阅读 · 0 评论 -
玲珑杯-1112 (倍增+二分)
DESCRIPTION小 L 有一串 QQ 个数排成一排,从左往右是 A1A1 开始一直到 AQAQ,它一直很喜欢这串数。有一天,小 L 去高考报名了,小 J 和小 N 过来用这串数玩游戏。一开始,小 N 手上有一个空序列,定义变量C:=0C:=0。小 J 从左往右依次把序列中的数取出,放到小 N 手上序列的最右边,如果放完之后,整个序列的混乱度超过了原创 2017-04-11 10:54:39 · 415 阅读 · 0 评论 -
2016山东省第七届ACM省赛-部分题解
sdut-3560-julyed:http://acm.sdut.edu.cn/onlinejudge2/index.php/Home/Index/problemdetail/pid/3560.htmlJulyedProblem Description Julyed is preparing for her CET-6. She has N words to rememb原创 2017-04-11 10:35:15 · 2410 阅读 · 0 评论 -
Contest - 2017年浙江理工大学程序设计竞赛校赛
点击:http://oj.acm.zstu.edu.cn/JudgeOnline/contest.php?cid=3650Problem A: 回文Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 1637 Solved: 505Description小王想知道一个字符串是否为ABA’型字符串。ABA’型字符原创 2017-03-22 15:30:09 · 2226 阅读 · 0 评论 -
Colossal Fibonacci Numbers! UVA - 11582 (数论,幂求模,规律周期)
直击题目:https://vjudge.net/problem/41990/origin题目大意:给出三个数,a,b,n;其中a,b题解:首先看到的是这个公式,f[i]=f[i-1]+f[i-2],那么假设f[a^b]=f[i]。而f[a^b]%n=f[i]%n=f[i-1]%n+f[i-2]%n.然后根据递推的关系可以看出,其实在求的过程中对每一个f[i]取模就可以了。当进行到这里的原创 2017-03-22 10:29:51 · 394 阅读 · 0 评论 -
The Tower of Babylon UVA - 437 (DAG上的动态规划变形,记忆化搜索)
Perhaps you have heard of the legend of the Tower of Babylon. Nowadays many details of this talehave been forgotten. So now, in line with the educational nature of this contest, we will tell you thewh原创 2017-03-10 21:43:08 · 381 阅读 · 0 评论 -
cf - 777C-Alyona and Spreadsheet(预处理)
During the lesson small girl Alyona works with one famous spreadsheet computer program and learns how to edit tables.Now she has a table filled with integers. The table consists of n rows and m co原创 2017-02-24 20:46:47 · 518 阅读 · 0 评论 -
cf 777B _ B. Game of Credit Cards (排序比较)
http://codeforces.com/contest/777/problem/BAfter the fourth season Sherlock and Moriary have realized the whole foolishness of the battle between them and decided to continue their competition原创 2017-02-24 20:03:26 · 1009 阅读 · 0 评论 -
Problem on Group Trip UVALive - 7219 (模拟+优先队列处理)
点击打开链接题目大意:有三个浴池s1,s2,s3,有n个人。每个人在每个浴池中所呆的时间为s[i].m1,s[i].m2,s[i].m3. 每次进浴池的时候要按n个人的序号的大小进行排队。310 25 150 0 250 15 10例如上面这组数据,有三个人,第一个人在s1中的时间是10,在s2中的时间是25,在s3中的时间是15,0表示这个人不需要再该浴池中,而且原创 2017-02-18 16:09:34 · 522 阅读 · 0 评论 -
HDU - 5929 Basic Data Structure(模拟+规律)
http://acm.hdu.edu.cn/showproblem.php?pid=5929Problem DescriptionMr. Frog learned a basic data structure recently, which is called stack.There are some basic operations of stack:∙ PUSH原创 2017-02-15 18:03:17 · 395 阅读 · 0 评论 -
gcd-matrix
https://www.hackerrank.com/contests/hourrank-17/challenges/gcd-matrixAlex has two arrays defined as and . He created an matrix, , where for each in . Recall that is the greates原创 2017-02-10 20:04:26 · 335 阅读 · 0 评论 -
K - Kia's Calculation (贪心构造)
Doctor Ghee is teaching Kia how to calculate the sum of two integers. But Kia is so careless and alway forget to carry a number when the sum of two digits exceeds 99. For example, when she calculate原创 2017-01-13 11:33:39 · 418 阅读 · 0 评论 -
CodeForces - 2A - Winner
点击链接:https://vjudge.net/problem/19977/originThe winner of the card game popular in Berland "Berlogging" is determined according to the following rules. If at the end of the game there is only on原创 2017-01-10 22:10:36 · 378 阅读 · 0 评论 -
vj Om Nom and Dark Park
DescriptionOm Nom is the main character of a game "Cut the Rope". He is a bright little monster who likes visiting friends living at the other side of the park. However the dark old parks can scar原创 2016-11-01 21:36:50 · 522 阅读 · 0 评论 -
vj Fox and Box Accumulation
DescriptionFox Ciel has n boxes in her room. They have the same size and weight, but they might have different strength. The i-th box can hold at most xi boxes on its top (we'll call xi the st原创 2016-11-01 21:23:55 · 353 阅读 · 0 评论 -
poj 1195 Mobile phones
题目链接:点击打开链接DescriptionSuppose that the fourth generation mobile phone base stations in the Tampere area operate as follows. The area is divided into squares. The squares form an S * S matrix w原创 2016-10-18 19:54:58 · 391 阅读 · 0 评论 -
线段树求逆序数(模板)
经过两天的调试终于弄明白了线段树求逆序数,;说一下思路: 首先建树是根据序列中最大的数开辟的区间,(如果数太大 离散化)。 逆序对可以表示成一个数前面有几个比这个数大的数,就表示这个数所形成的逆序对数,(听绕口的,需要模拟一下); 数列a[i],将数列a[i]添加到线段树中,并将区间中有它的区间的num+1,意思是在当前的区间上有几个值了,记录下来。 因为原创 2016-10-11 11:31:37 · 1004 阅读 · 0 评论 -
poj 3122 Pie
题目链接:点击打开链接DescriptionMy birthday is coming up and traditionally I'm serving pie. Not just one pie, no, I have a number N of them, of various tastes and of various sizes. F of my friends are c原创 2016-09-18 20:32:43 · 324 阅读 · 0 评论 -
codeforce New Problem(dfs)
题目链接:点击打开链接Coming up with a new problem isn't as easy as many people think. Sometimes it is hard enough to name it. We'll consider a title original if it doesn't occur as a substring in any原创 2016-09-07 15:07:57 · 319 阅读 · 0 评论 -
poj 1905 Expanding Rods
题目链接:点击打开链接DescriptionWhen a thin rod of length L is heated n degrees, it expands to a new length L'=(1+n*C)*L, where C is the coefficient of heat expansion. When a thin rod is mounted on tw原创 2016-08-24 15:27:49 · 355 阅读 · 0 评论 -
poj 3258 River Hopscotch
题目链接:点击打开链接DescriptionEvery year the cows hold an event featuring a peculiar version of hopscotch that involves carefully jumping from rock to rock in a river. The excitement takes place on a原创 2016-08-24 11:44:38 · 302 阅读 · 0 评论 -
poj 3274 Gold Balanced Lineup
题目链接: 点击打开链接DescriptionFarmer John's N cows (1 ≤ N ≤ 100,000) share many similarities. In fact, FJ has been able to narrow down the list of features shared by his cows to a list of only K di转载 2016-08-23 19:10:40 · 301 阅读 · 0 评论 -
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 t原创 2016-08-18 19:43:21 · 268 阅读 · 0 评论 -
Poj 1129 Channel Allocation
题目链接:点击打开链接DescriptionWhen a radio station is broadcasting over a very large area, repeaters are used to retransmit the signal so that every receiver has a strong signal. However, the channels原创 2016-08-18 19:27:01 · 281 阅读 · 0 评论 -
poj 2676 Sudoku
题目链接:点击打开链接DescriptionSudoku is a very simple task. A square table with 9 rows and 9 columns is divided to 9 smaller squares 3x3 as shown on the Figure. In some of the cells are written decima原创 2016-08-18 19:09:52 · 350 阅读 · 0 评论 -
poj 1416 Shredding Company
题目链接:点击打开链接DescriptionYou have just been put in charge of developing a new shredder for the Shredding Company Although a "normal" shredder would just shred sheets of paper into little pieces s原创 2016-08-18 18:58:39 · 271 阅读 · 0 评论 -
poj 3272 Monthly Expenset
题目链接:点击打开链接DescriptionFarmer John is an astounding accounting wizard and has realized he might run out of money to run the farm. He has already calculated and recorded the exact amount of mone原创 2016-08-16 21:54:24 · 292 阅读 · 0 评论 -
poj 2531 Network Saboteur
题目链接:点击打开链接DescriptionA university network is composed of N computers. System administrators gathered information on the traffic between nodes, and carefully divided the network into two subne原创 2016-08-16 21:27:17 · 314 阅读 · 0 评论 -
poj 3087 Shuffle'm Up
题目链接:点击打开链接DescriptionA common pastime for poker players at a poker table is to shuffle stacks of chips. Shuffling chips is performed by starting with two stacks of poker chips, S1 and S2, eac原创 2016-08-11 20:33:23 · 253 阅读 · 0 评论 -
poj 3414 Pots
题目链接:点击打开链接DescriptionYou are given two pots, having the volume of A and B liters respectively. The following operations can be performed:FILL(i) fill the pot i (1 ≤ i ≤ 2) from the原创 2016-08-11 20:30:09 · 291 阅读 · 0 评论 -
poj 2251 Dungeon Master
题目链接:点击打开链接DescriptionYou 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原创 2016-08-11 20:23:53 · 256 阅读 · 0 评论