![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
acm题目
文章平均质量分 94
axiaobingqiu
这个作者很懒,什么都没留下…
展开
-
POJ 1005 题的分析
题目:密西西比河岸某处陆地因为河水侵蚀,每年陆地面积都在减少,每年减少50平方英里,减少的陆地面积呈半圆形,即该半圆形面积以每年50平方英里的速度增长。在第一年初时,该半圆形面积为0,半圆形的圆心坐标为(0,0),现在的任务是给定一个坐标,求出该坐标在哪一年年底会被河水侵蚀。假设给定的坐标到圆心的距离不会等于半圆的半径。输入:第一行输入坐标个数,第二行开始输入坐标,每个坐标占一行,每个坐标由横原创 2017-10-24 23:35:20 · 430 阅读 · 0 评论 -
一个与公约数的变形 牛客网多校联赛第五场G题
Give two positive integer c, n. You need to find a pair of integer (a,b) satisfy 1<=a,b<=n and the greatest common division of a and b is c.And you need to maximize the product of a and b输入描述:...原创 2018-08-02 16:49:22 · 200 阅读 · 0 评论 -
输入输出外挂,以及题目51Nod1786
看了大牛的代码发现好友输入输出挂这种东西,太强。使得输入输出更加节省时间。代码如下:int read(){ char ch=' '; int ans =0; while(ch<'0'||ch>'9')ch=getchar(); while(ch<='9'&&ch>='0'){ ans=ans*10+ch-'0'; ch=getcha...原创 2018-08-07 11:22:52 · 109 阅读 · 0 评论 -
牛客网多校赛第五场 J题
链接:https://www.nowcoder.com/acm/contest/143/J来源:牛客网 There are n students going to travel. And hotel has two types room:double room and triple room. The price of a double room is p2 and the price o...原创 2018-08-02 19:18:11 · 183 阅读 · 0 评论 -
codeforces-918字符串'(' '('处理
题面:As Will is stuck in the Upside Down, he can still communicate with his mom, Joyce, through the Christmas lights (he can turn them on and off with his mind). He can't directly tell his mom wher...原创 2018-08-02 19:46:45 · 261 阅读 · 0 评论 -
codeforces-158B
题面:After the lessons n groups of schoolchildren went outside and decided to visit Polycarpus to celebrate his birthday. We know that the i-th group consists of sifriends (1 ≤ si ≤ 4), and they want ...原创 2018-08-02 20:02:37 · 476 阅读 · 0 评论 -
next_permutation 函数的使用 poj1256
next_permutation全排列函数是一个十分好用而且强大的函数。要想更好的了解这个函数可以看https://blog.csdn.net/howardemily/article/details/68064377个人感觉写的特别好,里面有要注意的点。这里上几个例题吧:number1:牛客网练习赛23D托米的咒语;链接:https://www.nowcoder.com/acm/con...原创 2018-08-08 08:41:35 · 6140 阅读 · 0 评论 -
位运算的强大与几个应用
这几天做了几道关于位运算的题目发现,位运算是真的强,太牛了;举几个例子:4: 100分别于4按位与运算 5: 101&: 1006: 110&: 1007: 111&: 1008: 1000&:0000 3: 11&: 000推导出在2^n到2^(n+1)之间一直按位与结果都是2^n; 上述的规律就是解决...原创 2018-08-08 10:28:33 · 322 阅读 · 0 评论 -
Codeforces 1000c(线段相交求点覆盖问题)
这道题所实话我是不会做,看了别人的代码也是懵懵懂懂,脑水不行,这里就写一点自己的理解吧。看着别人的代码几行解决了,啥时候咋也可以信手拈来。先对每个集合的端点排序,并且对左右有要求,不可以笼统的一起排序,要标记那个电视开始端,那个点是结束端。然后通过数组来统计被覆盖的次数,很神奇。哈哈哈;代码如下,31 32 31 4---1 11 12 14 -14 -15...原创 2018-08-08 10:51:01 · 236 阅读 · 0 评论 -
codeforces - 920B(贪心)
B. Tea Queuetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRecently n students from city S moved to city P to attend a programmi...原创 2018-08-13 10:24:31 · 366 阅读 · 0 评论 -
codeforces-954B(模拟+贪心字符串复制)
题面:You are given a string s consisting of n lowercase Latin letters. You have to type this string using your keyboard.Initially, you have an empty string. Until you type the whole string, you may ...原创 2018-08-13 10:36:39 · 827 阅读 · 0 评论 -
codeforces -63B(贪心,求做后达标需要的天数)
题面:In a strategic computer game "Settlers II" one has to build defense structures to expand and protect the territory. Let's take one of these buildings. At the moment the defense structure accommod...原创 2018-08-13 10:42:57 · 223 阅读 · 0 评论 -
codeforces - 821B-(在函数中求包含的点值想加的最大值)
题面:Okabe needs bananas for one of his experiments for some strange reason. So he decides to go to the forest and cut banana trees.Consider the point (x, y) in the 2D plane such that x and y are in...原创 2018-08-13 10:49:22 · 202 阅读 · 0 评论 -
codeforces -1006C
题面:You are given an arrayd1,d2,…,dnd1,d2,…,dnconsisting ofnninteger numbers.Your task is to split this array into three parts (some of which may be empty) in such a way that each element of th...原创 2019-05-27 20:42:25 · 308 阅读 · 0 评论 -
codeforces-1006D通过改变使得两个字符串相同
题面:You are given two strings aa and bb consisting of lowercase English letters, both of length nn. The characters of both strings have indices from 11 to nn, inclusive.You are allowed to do the fo...原创 2018-08-13 11:02:09 · 568 阅读 · 0 评论 -
给定多个体重,删除其中几个,问剩下的最多可以组成多少种情况。
这是我们学校淘汰赛的一道题,做的时候不会。题目如下:题目描述yxy送了小姐姐礼物后,和小姐姐快乐地在一起了,在爱情的培养下他的体重迅速增加。某一天他突然把实验室的椅子坐坏了,于是潘老师发现了问题,他就算很胖也不该坐坏椅子啊。果然潘老师发现了一个奇妙的现象:实验室的椅子其实可以测量出坐在椅子上人的体重,经过了几个月的观察,潘老师发现很多椅子统计出的数据有了明显的增加,导致椅...原创 2018-10-25 20:20:06 · 131 阅读 · 0 评论 -
最大化平均值 牛客网多校联赛第五场A题
Kanade selected n courses in the university. The academic credit of the i-th course is s[i] and the score of the i-th course is c[i].At the university where she attended, the final score of her is ...原创 2018-08-02 16:44:45 · 141 阅读 · 0 评论 -
OpenJ_Bailian 4115鸣人找佐助
题面如下:佐助被大蛇丸诱骗走了,鸣人在多少时间内能追上他呢?已知一张地图(以二维矩阵的形式表示)以及佐助和鸣人的位置。地图上的每个位置都可以走到,只不过有些位置上有大蛇丸的手下,需要先打败大蛇丸的手下才能到这些位置。鸣人有一定数量的查克拉,每一个单位的查克拉可以打败一个大蛇丸的手下。假设鸣人可以往上下左右四个方向移动,每移动一个距离需要花费1个单位时间,打败大蛇丸的手下不需要时间。如果...原创 2018-08-07 10:32:24 · 166 阅读 · 0 评论 -
最长连续子串
链接:https://www.nowcoder.com/questionTerminal/276712b113c6456c8cf31c5073a4f9d7?orderByHotValue=1&page=1&onlyReference=false来源:牛客网牛牛有两个字符串(可能包含空格),牛牛想找出其中最长的公共连续子串,希望你能帮助他,并输出其长度。输入描述:输入为两行字符串(可...原创 2018-03-14 17:36:22 · 2392 阅读 · 0 评论 -
HDU1232
此题目的链接:http://acm.hdu.edu.cn/showproblem.php?pid=1232点击打开链接这道题是关于并查集的一道经典例题并查集的几求解:实际上就是个不断更新的过程。此题的代码如下: #include<iostream>#include<cstdio>#include<cstring>using namespace st...原创 2018-03-10 14:59:47 · 680 阅读 · 1 评论 -
字符消除
#1039 : 字符消除时间限制:1000ms单点时限:1000ms内存限制:256MB描述小Hi最近在玩一个字符消除游戏。给定一个只包含大写字母"ABC"的字符串s,消除过程是如下进行的:1)如果s包含长度超过1的由相同字母组成的子串,那么这些子串会被同时消除,余下的子串拼成新的字符串。例如"ABCCBCCCAA"中"CC","CCC"和"AA"会被同时消除,余下"AB"和"B原创 2018-03-14 16:42:10 · 616 阅读 · 0 评论 -
最长公共子序列
给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的)。比如两个串为:abcicbaabdkscabab是两个串的子序列,abc也是,abca也是,其中abca是这两个字符串最长的子序列。Input第1行:字符串A第2行:字符串B(A,B的长度 <= 1000)Output输出最长的子序列,如果有多个,随意输出1个。Input示例abcicbaabdkscabOutpu...原创 2018-03-14 17:11:02 · 144 阅读 · 0 评论 -
第13届景驰-埃森哲杯广东工业大学ACM程序设计大赛部分题解
太菜补题中题解:number1:跳台阶 #include<iostream>#include<cstdio>#include<cstring>#include<algorithm>using namespace std;int main(){ int n; cin>>n; int m; while(n--){ ...原创 2018-05-11 16:50:06 · 158 阅读 · 0 评论 -
poj2385 Apple Catching
t is a little known fact that cows love apples. Farmer John has two apple trees (which are conveniently numbered 1 and 2) in his field, each full of apples. Bessie cannot reach the apples when they ar...原创 2018-05-26 20:09:14 · 148 阅读 · 0 评论 -
计算任意多边形的面积
证明过程就略过了,有好多大佬已经都写过了。我只是在这复习一下。比较粗浅。首先给公式:这里以一个题目演示是一下:链接:https://www.nowcoder.com/acm/contest/127/C来源:牛客网众所周知的是,小X特别喜欢由线条组成的形状,比如说凸多边形,这一天小X正在纸上画着喜欢的凸多边形,这时候小Y走了过来,指着一张图片上的多边形,问小X知道这个图形的面积么,这可把小X难住了,...原创 2018-06-09 19:30:46 · 400 阅读 · 0 评论 -
牛客网挑战赛21 A灯塔
链接:https://www.nowcoder.com/acm/contest/159/A来源:牛客网 Z市是一座港口城市,来来往往的船只依靠灯塔指引方向。在海平面上,存在n个灯塔。每个灯塔可以照亮以它的中心点为中心的90°范围。特別地, 由于特殊限制,每个灯塔照亮范围的角的两条边必须要么与坐标轴平行要么与坐标轴成45°。 由于经费限制,Z市的灯塔只能被点亮一座。你需要求出在这种情况下,...原创 2018-08-03 21:12:56 · 379 阅读 · 0 评论 -
codeforces The Phone number(最长上升与最长下降之和最小)
题面:C. The Phone Numbertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMrs. Smith is trying to contact her husband, John Smith, ...原创 2018-08-09 08:45:26 · 305 阅读 · 0 评论 -
UVa 11538 象棋中的皇后
最近发现自己没有什么长进,一直在徘徊中,发现自己的知识储备太少,简直菜的不行,目前在看组合数,排列,加法,乘法,容斥原理。 题目通过三个方面考虑: 同一行放两个皇后的方案数为A(n,m); 同一列放两个皇后的方案数为B(n,m); 同一对角线放两个皇后的方案数为D(n...原创 2018-07-31 10:45:06 · 170 阅读 · 0 评论 -
UVa 11401 数三角形-推公式求答案
题目如下:这道题是看书做的,看了人家的想法,就是到了自己的差距不仅仅是做题数,还有智商,与想法。太强。这道题的目的给定一个数,让你求从1~n中可以做成多少三角形。暴力是不行的:这时就要想其他的办法。首先要知道组成三角形的条件,这里就不多说了;算法题也可已有设未知数来求解。这就很牛了。证明过程及描述如下:使用加法定理。设最大边长为x的三角形有C(x)个。另外两条边长为z,y;根据...原创 2018-07-31 14:17:45 · 257 阅读 · 0 评论 -
Hdu 6322
做多校赛的题,自己只能做点简单的,大家都会的,菜是原罪啊。。。。In number theory, Euler's totient function φ(n)φ(n) counts the positive integers up to a given integer nn that are relatively prime to nn. It can be defined more form...原创 2018-07-31 14:37:14 · 202 阅读 · 0 评论 -
暴力枚举,Codeforces 1011B
Natasha is planning an expedition to Mars for nn people. One of the important tasks is to provide food for each participant.The warehouse has mm daily food packages. Each package has some food ty...原创 2018-08-01 09:32:28 · 199 阅读 · 0 评论 -
百度之星2018初赛-度度熊拼三角
题面:度度熊有 NN 根木棒,每根木棒的长度为a_iai。现在要挑选其中的三根,问能拼出的三角形的最大周长是多少。如果不能拼成任何一个三角形,输出 -1−1。Input多组数据(不超过1010组),读到EOF结束。对于每一组数据:第一行一个数 NN 表示木棒数量。第二行一共 NN 个数,描述每一根木棒的长度。1 \leq N \leq 10001≤N≤10...原创 2018-08-11 14:56:00 · 1343 阅读 · 0 评论 -
OpenJ_Bailian-4116. 拯救公主
题面如下: 公主被恶人抓走,被关押在牢房的某个地方。牢房用N*M (N, M <= 200)的矩阵来表示。矩阵中的每项可以代表道路(@)、墙壁(#)、和守卫(x)。 英勇的骑士(r)决定孤身一人去拯救公主(a)。我们假设拯救成功的表示是“骑士到达了公主所在的位置”。由于在通往公主所在位置的道路中可能遇到守卫,骑士一旦遇到守卫,必须杀死守卫才能继续前进。 现假设骑士可以向上、下、左...原创 2018-08-07 10:28:23 · 1184 阅读 · 0 评论 -
Working out(dp)给定一个数组求最值
题目的大意是给定一个数组,有两个人在走,其中一个从(1,1) ->(n,m)另一个是从(n, 1)- > (1,m)在这期间他们会相遇一次,相遇的时候不加数组值,求两个人走到终点的时候最大和是多少。题目如下:Summer is coming! It's time for Iahub and Iahubina to work out, as they both want to lo...原创 2018-10-25 20:45:18 · 142 阅读 · 0 评论