SDNU
文章平均质量分 81
陈年风褛
这个作者很懒,什么都没留下…
展开
-
蓝桥杯 算法训练 结点选择 DP(SDNU 1482.结点选择)
结点选择问题描述有一棵 n 个节点的树,树上每个节点都有一个正整数权值。如果一个点被选择了,那么在树上和它相邻的点都不能被选择。求选出的点的权值和最大是多少?输入格式第一行包含一个整数 n 。接下来的一行包含 n 个正整数,第 i 个正整数代表点 i 的权值。接下来一共 n-1 行,每行描述树上的一条边。输出格式输出一个整数,代表选出的点的权值和的最大值。样例输入51 2 3 4 51 21 32...原创 2018-03-28 10:12:45 · 209 阅读 · 0 评论 -
SDNU 1311.Binomial Coeffcients 杨辉三角算组合数
1311.Binomial CoeffcientsDescriptionThe binomial coefficientis the number of ways of picking k unordered outcomes from n possibilities, also known as a combination or combinatorial number.原创 2016-09-29 20:49:47 · 630 阅读 · 0 评论 -
SDNU 1011.盒子与球 第二类stirling数
1011.盒子与球Description现有r个互不相同的盒子和n个互不相同的球,要将这n个球放入r个盒子中,且不允许有空盒子。则有多少种放法?Inputn, r(0 Output有多少种放法。Sample Input3 2Sample Output6 当时刚入坑的时候SDNU前面一道一直没能A的原创 2016-10-13 20:11:36 · 1157 阅读 · 0 评论 -
SDNU 1370.Freckles 最小生成树 kruskal算法
1370.FrecklesTime Limit: 1000 MS Memory Limit: 131072 KBDescriptionIn an episode of the Dick Van Dyke show, little Richie connects the freckles on his Dad's back to form a picture of th原创 2017-05-05 12:40:27 · 939 阅读 · 0 评论 -
SDNU 1229.A math problem 最小生成树 prim算法
1229.A math problemTime Limit: 1000 MS Memory Limit: 131072 KBDescriptionlmh is now doing a math problem, known to have the coordinates of n points, find the shortest distance to connect原创 2017-05-05 12:31:20 · 1121 阅读 · 0 评论 -
SDNU 1094.Clock 时针分针角度
1094.ClockTime Limit: 1000 MS Memory Limit: 32768 KBDescriptionThere is an analog clock with two hands: an hour hand and a minute hand. The two hands form an angle. The angle is measured as原创 2017-04-20 16:11:51 · 915 阅读 · 0 评论 -
SDNU 1209.磊磊的随机数 set
1209.磊磊的随机数Time Limit: 1000 MS Memory Limit: 32768 KBDescription磊磊想在学校中请一些同学一起做一项问卷调查,为了实验的客观性,他先用计算机生成了N个1到1000之间的随机整数(N≤100),对于其中重复的数字,只保留一个,把其余相同的数去掉,不同的数对应着不同的学生的学号。然后再把这些数从小到大排序,按照排好原创 2017-04-20 15:50:46 · 757 阅读 · 0 评论 -
SDNU 1077.采药4 01背包剩余容量
1077.采药4Time Limit: 1000 MS Memory Limit: 32768 KBDescriptionXXX上山去采药。XXX有一个容量为m(1Input第一行为两个整数m和n,分别表示背包容量及药材数量,第二行n个整数,分别表示n株药材的重量。Output一个整数,背包最小剩余容量。Sample Input原创 2017-04-20 15:25:12 · 1166 阅读 · 0 评论 -
SDNU 1061.采药3 二维费用背包
1061.采药3Time Limit: 1000 MS Memory Limit: 32768 KBDescriptionXXX上山去采药。XXX有一个最大承重为m(1Input第1行为三个整数m、t和n,分别为背包的最大承重、容积及药材的数量。 第2至n+1行每行三个整数w1、w2和v,分别表示每株药材的重量、体积及价值。Output能采到的原创 2017-04-20 15:18:56 · 849 阅读 · 0 评论 -
SDNU 1043.采药2 完全背包
1043.采药2Time Limit: 1000 MS Memory Limit: 32768 KBDescriptionXXX上山去采药。XXX有一个容量为m(1Input第1行为两个整数m和n,分别为背包的容量及药材的种数。 第2至n+1行每行两个整数w和v,分别表示每种药材的重量及价值。Output能采到的药材的最大总价值Sa原创 2017-04-20 15:16:06 · 622 阅读 · 0 评论 -
SDNU 1030.烽火台 SPFA
1030.烽火台Time Limit: 1000 MS Memory Limit: 32768 KBDescription烽火台是一种传递信息的手段,通过在烽火台处燃起狼烟,使其他烽火台或要传递到的人看到,从而达到传递信息的目的。已知有N个烽火台围绕一座城池,每个烽火台k燃起狼烟都需要一定的时间,记为该烽火台燃起狼烟所需的代价Wk,两座能够传递信息的烽火台i、j之间,因为原创 2017-07-31 19:42:53 · 570 阅读 · 0 评论 -
SDNU 1267.越挫越勇 贪心
1267.越挫越勇Time Limit: 1000 MS Memory Limit: 32768 KBDescription在比赛的时候,实力是决定胜负的关键,一般而言,实力越高的人能够得到胜利。但是,如果双方实力很接近,反而会激发弱者的能力,使他心中有股拼劲想要超过对方,往往是弱的一方赢。(当然,如果实力差距太大弱的一方再努力也是赢不了的。)现在,马上要开始一场原创 2017-08-10 10:35:47 · 303 阅读 · 0 评论 -
SDNU 1519.lmh’s Function 找循环节
1519.lmh’s FunctionProblem Description One day,lmh did a problem in HDU.But he doubted thisproblem is wrong.At last,he found the reason is he get the wrong meaning of thetitle.He spent a lot原创 2017-07-28 09:19:18 · 340 阅读 · 0 评论 -
蓝桥杯 历届试题 买不到的数目 DP(SDNU 1420.买不到的数目)
买不到的数目问题描述小明开了一家糖果店。他别出心裁:把水果糖包成4颗一包和7颗一包的两种。糖果不能拆包卖。小朋友来买糖的时候,他就用这两种包装来组合。当然有些糖果数目是无法组合出来的,比如要买 10 颗糖。你可以用计算机测试一下,在这种包装情况下,最大不能买到的数量是17。大于17的任何数字都可以用4和7组合出来。本题的要求就是在已知两个包装的数量时,求最大不能组合出的数字。输入格式两个正整数,表...原创 2018-03-28 10:06:35 · 353 阅读 · 1 评论 -
SDNU 1260.Problem H. The chord 最长公共子串
1260.Problem H. The chordTime Limit: 1000 MS Memory Limit: 32768 KBDescriptionNow lmh has already written a new GTP, he know how to play the broken chord by right hand. But as for the left hand cho...原创 2018-04-03 16:35:56 · 283 阅读 · 1 评论 -
SDNU 1259.Problem G. play the guitar Java大数
1259.Problem G. play the guitarTime Limit: 1000 MS Memory Limit: 32768 KBDescriptionlmh like playing the guitar, but he don’t satisfy others’ GTP. He want to write guitar score by himself. And he d...原创 2018-04-03 16:23:05 · 234 阅读 · 0 评论 -
SDNU 1258.Problem F. The Avengers kruskal
1258.Problem F. The AvengersTime Limit: 1000 MS Memory Limit: 32768 KBDescriptionWhen global security is threatened by Loki, Nick Fury and his team will need a team to protect the world from disast...原创 2018-04-03 16:18:00 · 249 阅读 · 2 评论 -
SDNU 1528.Reasoning test 暴力模拟
1528.Reasoning testTime Limit: 1000 MS Memory Limit: 32768 KBTotal Submission(s): 4 Accepted Submission(s): 4DescriptionIn 2018,Jiangsu provincial public security network security team’s officia...原创 2018-03-28 09:54:23 · 248 阅读 · 0 评论 -
SDNU 1117.循环 高精度数 思维
1117.循环Description乐乐是一个聪明而又勤奋好学的孩子。他总喜欢探求事物的规律。一天,他突然对数的正整数次幂产生了兴趣。众所周知,2的正整数次幂最后一位数总是不断的在重复2,4,8,6,2,4,8,6……我们说2的正整数次幂最后一位的循环长度是4(实际上4的倍数都可以说是循环长度,但我们只考虑最小的循环长度)。类似的,其余的数字的正整数次幂最后一位数也有类似的原创 2017-11-10 11:36:49 · 649 阅读 · 0 评论 -
SDNU作弊码
自己整理的SDNUOJ的题解 做一道整理一道= = 一些题后面标注了我用的方法,有些是为了我写模板用了麻烦的方法,没必要完全照着我说的做 第一页已AK(2017.11.10)1000~1009 ---- 新手入门专用水题1010 ---- 水题1011 ---- 第二类string数*r的阶乘1012 ---- 区间合并1013 ---- 水题 排序 暴力1014 ---- 水...原创 2016-10-18 19:48:37 · 5489 阅读 · 1 评论 -
SDNU 1116.Keywords Search AC自动机 裸题
1116.Keywords SearchDescriptionIn the modern time, Search engine came into the life of everybody like Google, Baidu, etc.Wiskey also wants to bring this feature to his image retrieval system.原创 2017-11-08 17:01:23 · 528 阅读 · 0 评论 -
SDNU 1306.兑数 数论 水题
1306.兑数Description [n≥3] ,定义使A3*A4*…*Ak为整数的k [k≥3]叫做兑数。求取区间[3,x]内所有兑数的和加上4是多少。Input输入包含多组数据,每一行是一个数x,xOutput每组测试数据输出对应的一行答案,每组数据间有两个空行。具体输出格式见样例。Sample Input510原创 2016-09-21 12:39:21 · 912 阅读 · 1 评论 -
SDNU 1033.采药 01背包 裸题
1033.采药Time Limit: 1000 MS Memory Limit: 32768 KBDescription辰辰是个天资聪颖的孩子,他的梦想是成为世界上最伟大的医师。为此,他想拜附近最有威望的医师为师。医师为了判断他的资质,给他出了一个难题。医师把他带到一个到处都是草药的山洞里对他说:“孩子,这个山洞里有一些不同的草药,采每一株都需要一些时间,每一株也有它自身的价原创 2017-04-20 15:13:09 · 467 阅读 · 0 评论 -
SDNU 1490.Problem_H Miller_Rabin算法判断素数
1490.Problem_HTime Limit: 3000 MS Memory Limit: 32768 KBDescriptionGive you a lot of positive integers, just to find out how many prime numbers there are.InputThere are a lot of原创 2017-04-15 20:57:40 · 812 阅读 · 0 评论 -
SDNU 1031.字母排序 拓扑排序
1031.字母排序Time Limit: 1000 MS Memory Limit: 32768 KBDescription有若干个字母,已知它们中某些字母之间的前后关系,求它们的排列顺序。Input输入数据包含若干组。每组数据第一行两个整数N(2 之后M行,为一个条件,格式为:字母字母,如AB代表A在B的后面。Output对于每组输入原创 2017-05-01 18:14:31 · 1089 阅读 · 0 评论 -
SDNU 1309.啤酒和饮料 水题 小数的判断
1309.啤酒和饮料Description啤酒每罐2.3元,饮料每罐1.9元。小明买了若干啤酒和饮料,一共花了N元。请你计算他买了几罐啤酒和几罐饮料(罐数为整数)。Input一个double型数据NOutput输出啤酒和饮料的罐数,如果存在多组结果按照啤酒数从大到小排列;如果没有解答输出"No Solution"Sample Inpu原创 2016-09-29 12:52:22 · 1242 阅读 · 0 评论 -
SDNU 1307.JY的分形绘画室 递归 打印图形
1307.JY的分形绘画室DescriptionJY的完美绘画教室~今天要教的是分形图形,它是一类递归定义的图形,在这里举一个例子。这个图形的每一层都由3个下一层的图形拼凑而成,现在我们可以编程来画一个简单的版本,你能实现吗?Input一个正整数N, 1Output图形,具体见样例。Sample Input原创 2016-09-29 12:44:36 · 686 阅读 · 0 评论 -
SDNU 1352.Stalingrad: Enemy at the Gates 树状DP
1352.Stalingrad: Enemy at the GatesDescription Enemy at the gates! King James let you be the general of the Royal Army to defend the country, you know the fighting capacity of the soldie原创 2016-10-13 19:57:44 · 392 阅读 · 0 评论 -
SDNU 1093.DNA排序 稳定排序(基数排序)
1093.DNA排序Description逆序数可以用来是描述一个序列混乱成度的量。例如,“DAABEC”的逆序数为5,其中D大于它右边的4个数,E大于它右边的1个数,4+1=5;又例如“ZWQM”的逆序数为3+2+1+0=6。现在有许多长度一样的字符串,每个字符串里面只会出现四种字母(A,T,G,C)。你现在被要求编写程序将这些字符串按照他们的逆序数进行排序Input原创 2016-10-13 19:25:01 · 785 阅读 · 0 评论 -
SDNU 1016.矩形合并 并查集
1016.矩形合并Time Limit: 1000 MS Memory Limit: 32768 KBTotal Submission(s): 242 Accepted Submission(s): 49Description平面上有n个矩形,给定每个矩形的左下角坐标和右上角坐标。如果把重合的矩形合并成一个图形,则经过合并之后,还剩多少个图形?原创 2016-10-22 13:30:01 · 1508 阅读 · 0 评论 -
SDNU 1305.Hamming Codes 位运算
1305.Hamming CodesDescriptionGiven N, B, and D: Find a set of N codewords (1 <= N <= 64), each of length B bits (1 <= B <= 8), such that each of the codewords is at least Hamming distance of D原创 2016-09-21 12:30:00 · 326 阅读 · 0 评论 -
SDNU 1304.约瑟夫环的强化版 打表......
1304.约瑟夫环的强化版Description约瑟夫环问题的简单强化版。约瑟夫环是这样的:n个人组成一个环,编号为1,2...N,站在圆圈的每第m个将出列,直到所有人都出列。例如,当n= 6和m = 5那么5,4,6,2,3和1将按顺序逐一出列。假设有k好人和k坏人组成一个环。在圈内的前k是好人和最后K个坏人。由你来确定,所有的坏人会在好人之前出列的最小m。I原创 2016-09-21 12:18:10 · 425 阅读 · 0 评论 -
SDNU 1303.A+B(高精度) ......
1303.A+B(高精度)Description求A+BInput多组测试样例。两个正整数X,Y(0≤X,Y≤10^100)Output输出结果Sample Input1 112345 54321Sample Output266666 题目已经说的很清楚是高精度了.......原创 2016-09-21 12:13:59 · 480 阅读 · 0 评论 -
SDNU 1301.判断相等 字符串比较数字
1301.判断相等Description给定两个数A和B(长度不超过100),判断A和B是否相等。Input有多组测试数据,每组测试数据占一行,每行两个数A和B,由空格隔开。Output每个测试数据的结果输出到一行,如果A和B相等输出"yes",否则输出"no"。Sample Input-00.00 000原创 2016-09-21 11:53:44 · 597 阅读 · 0 评论 -
SDNU 1172.Queue nlogn的最长子序列算法
1172.QueueDescription On the PE,the teacher wants to choose some of n students to play games. Teacher asks n students stand in a line randomly(obviously,they have different height), then teac原创 2016-09-29 19:46:32 · 320 阅读 · 0 评论 -
SDNU 1334.Jason's Water Problem 向量的叉积求多边形面积
1334.Jason's Water ProblemDescriptionCalculus is the first lesson Jason had. It is tedious, so an interesting idea occurred to Jason. He took out his mobile phone and open the HDUOJ and found原创 2016-09-29 20:11:11 · 344 阅读 · 0 评论 -
SDNU 1310.Cover Interval 区间合并之后求覆盖的区间长度
1310.Cover IntervalDescriptionOn the math class, Teacher Young want to know some of students’ ability of programming, so he write a simple problem on the blackboard: “There are sever原创 2016-09-29 20:30:19 · 507 阅读 · 0 评论 -
SDNU 1089.拓扑排序 ...
1089.拓扑排序Time Limit: 1000 MS Memory Limit: 32768 KBDescription给定一个有向图,若图无环,则将其进行拓扑排序并输出,否则输出IMPOSABLE。Input第一行为两个整数n(1之后m行,每行两个整数a、b表示一条从a到b的有向边。Output若存在环,输出IMPOSABLE,否则输原创 2017-05-01 17:54:22 · 872 阅读 · 0 评论 -
SDNU 1501.Problem_J 贪心
1501.Problem_JTime Limit: 2000 MS Memory Limit: 32768 KBDescriptionSo long coding time make ChaoChao be more nonsense. In order to spend the boring time, ChaoChao plan to practice his coo原创 2017-04-14 13:53:22 · 473 阅读 · 0 评论 -
SDNU 1499.Problem_H 巴什博奕 Java大数
1499.Problem_HTime Limit: 1000 MS Memory Limit: 32768 KBDescriptionSpring is coming, too.(Why do I say too?)SDNU is a school what has a gender imbalance. There are some beautiful girl原创 2017-04-14 13:13:21 · 380 阅读 · 0 评论