![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C++
HHY823
网络一线牵,珍惜这个猿 TvT
展开
-
素数圆环(dfs)
链接:https://ac.nowcoder.com/acm/contest/3474/C来源:牛客网一个由n个圆圈构成的圆环。将自然数1,2,…,n放入圆圈内,并且要求任意两个相邻的圆圈内的数字之和为素数。请问给你圆圈数,你能给出放置自然数的所有正确方案吗?注意:圆圈中的数字一定是从1开始的,并且连续不重复。#include <bits/stdc++.h>using ...原创 2019-12-21 13:59:06 · 736 阅读 · 0 评论 -
Red/Blue Spanning Tree
Problem DescriptionGiven an undirected, unweighted, connected graph, where each edge is colored either blue or red, determine whether a spanning tree with exactly k blue edges exists.InputThere wil...原创 2019-11-30 13:06:14 · 185 阅读 · 0 评论 -
Rectangles(搜索)
描述A rectangle in the Cartesian plane is specified by a pair of coordinates (x1 , y1) and (x2 , y2) indicating its lower-left and upper-right corners, respectively (where x1 <= x2 and y1 <= y2)....原创 2019-11-19 19:42:12 · 243 阅读 · 0 评论 -
Hard math problem(递归)
描述Xioumu was trapped by a mathematical puzzle recently.He wrote the number 0,1,2 on the blackboard, and then he does lots of operations on them, in each operation, he took out the larger two numbers...原创 2019-11-19 19:26:04 · 339 阅读 · 0 评论 -
Detachment
Problem DescriptionIn a highly developed alien society, the habitats are almost infinite dimensional space.In the history of this planet,there is an old puzzle.You have a line segment with x units’...原创 2019-11-17 16:59:48 · 234 阅读 · 0 评论 -
Riding the Fences(欧拉回路)
描述Farmer John owns a large number of fences that must be repaired annually. He traverses the fences by riding a horse along each and every one of them (and nowhere else) and fixing the broken parts....原创 2019-11-17 16:30:03 · 201 阅读 · 0 评论 -
逃生(拓扑排序,反向)
描述糟糕的事情发生啦,现在大家都忙着逃命。但是逃命的通道很窄,大家只能排成一行。现在有n个人,从1标号到n。同时有一些奇怪的约束条件,每个都形如:a必须在b之前。同时,社会是不平等的,这些人有的穷有的富。1号最富,2号第二富,以此类推。有钱人就贿赂负责人,所以他们有一些好处。负责人现在可以安排大家排队的顺序,由于收了好处,所以他要让1号尽量靠前,如果此时还有多种情况,就再让2号尽量靠前,如...原创 2019-11-17 16:21:50 · 230 阅读 · 1 评论 -
Mine Sweeping
描述The opening ceremony of the 28th Asia Game is coming. In order to prevent the game from being attacked by terrorists, Asia Compete Machinery (ACM) takes lots operations as security measures.Mine s...原创 2019-11-13 20:20:27 · 217 阅读 · 0 评论 -
Just Pour the Water
描述Shirly is a very clever girl. Now she has two containers (A and B), each with some water. Every minute, she pours half of the water in A into B, and simultaneous pours half of the water in B into A...原创 2019-11-13 20:06:14 · 1140 阅读 · 0 评论 -
Changlong's bother
描述Changlong is a handsome and clever boy and he is admired by many beautiful girls. Every day he received tens of thousands of letters form girls which express their intense desire to be his life com...原创 2019-11-13 19:43:38 · 130 阅读 · 0 评论 -
sum(简单题)
描述Given a sequence, you’re asked whether there exists a consecutive subsequence whose sum is divisible by m. output YES, otherwise output NO输入The first line of the input has an integer T (1≤T≤10), ...原创 2019-11-03 16:50:23 · 368 阅读 · 0 评论 -
LCM Walk
描述A frog has just learned some number theory, and can’t wait to show his ability to his girlfriend.Now the frog is sitting on a grid map of infinite rows and columns. Rows are numbered 1,2,⋯ from th...原创 2019-11-03 16:39:21 · 259 阅读 · 0 评论 -
Dominos 2(dfs)
描述Dominos are lots of fun. Children like to stand the tiles on their side in long lines. When one domino falls, it knocks down the next one, which knocks down the one after that, all the way down the...原创 2019-11-03 15:58:48 · 394 阅读 · 0 评论 -
Anniversary party(最基础的树形dp)
描述There is going to be a party to celebrate the 80-th Anniversary of the Ural State University. The University has a hierarchical structure of employees. It means that the supervisor relation forms a...原创 2019-11-02 16:24:11 · 239 阅读 · 0 评论 -
The Best Path(欧拉路)
Problem DescriptionAlice is planning her travel route in a beautiful valley. In this valley, there are N lakes, and M rivers linking these lakes. Alice wants to start her trip from one lake, and enjo...原创 2019-11-02 16:09:55 · 118 阅读 · 0 评论 -
A Walk Through the Forest(最短路+搜索)
描述Jimmy experiences a lot of stress at work these days, especially since his accident made working difficult. To relax after a hard day, he likes to walk home. To make things even nicer, his office i...原创 2019-11-01 20:32:32 · 288 阅读 · 0 评论 -
确定比赛名次(拓扑排序)
描述有N个比赛队(1<=N<=500),编号依次为1,2,3,。。。。,N进行比赛,比赛结束后,裁判委员会要将所有参赛队伍从前往后依次排名,但现在裁判委员会不能直接获得每个队的比赛成绩,只知道每场比赛的结果,即P1赢P2,用P1,P2表示,排名时P1在P2之前。现在请你编程序确定排名。输入输入有若干组,每组中的第一行为二个数N(1<=N<=500),M(0<=M...原创 2019-10-29 19:35:22 · 230 阅读 · 0 评论 -
Happy Necklace(矩阵快速幂)
Problem DescriptionLittle Q wants to buy a necklace for his girlfriend. Necklaces are single strings composed of multiple red and blue beads.Little Q desperately wants to impress his girlfriend, he ...原创 2019-10-27 16:25:59 · 140 阅读 · 0 评论 -
GCD(欧拉函数)
描述The greatest common divisor GCD(a,b) of two positive integers a and b,sometimes written (a,b),is the largest divisor common to a and b,For example,(1,2)=1,(12,18)=6.(a,b) can be easily found by th...原创 2019-10-26 16:19:16 · 366 阅读 · 0 评论 -
Following Orders(拓扑排序)
DescriptionOrder is an important concept in mathematics and in computer science. For example, Zorn’s Lemma states: ``a partially ordered set in which every chain has an upper bound contains a maximal...原创 2019-10-26 15:31:09 · 705 阅读 · 0 评论 -
取石子游戏&&Game of Taking Stones
取石子游戏Problem Description有两堆石子,数量任意,可以不同。游戏开始由两个人轮流取石子。游戏规定,每次有两种不同的取法,一是可以在任意的一堆中取走任意多的石子;二是可以在两堆中同时取走相同数量的石子。最后把石子全部取完者为胜者。现在给出初始的两堆石子的数目,如果轮到你先取,假设双方都采取最好的策略,问最后你是胜者还是败者。Input输入包含若干行,表示若干种石子的初始情...原创 2019-10-25 19:51:03 · 860 阅读 · 0 评论 -
A Simple Math Problem
Problem DescriptionGiven two positive integers a and b,find suitable X and Y to meet the conditions:X+Y=aLeast Common Multiple (X, Y) =bInputInput includes multiple sets of test data.Each test da...原创 2019-10-25 19:14:29 · 226 阅读 · 0 评论 -
Wrestling Match(图、搜索)
Problem DescriptionNowadays, at least one wrestling match is held every year in our country. There are a lot of people in the game is "good player”, the rest is "bad player”. Now, Xiao Ming is refere...原创 2019-10-22 19:28:51 · 663 阅读 · 0 评论 -
Adrien and Austin
先手中间对半取数字,如果能成功使剩下的左右两边的数量相同就先手胜(后手拿什么,先手跟着拿一样的),否则后手胜#include <bits/stdc++.h>using namespace std;int main(){ int n,k; cin>>n>>k; if(n==0||(n%2==0&&k==1)){ ...原创 2019-10-19 21:18:54 · 252 阅读 · 0 评论 -
Honeycomb(bfs)
题目A honeycomb is a mass wax cells built by honey bees, which can be described as a regular tiling of the Euclidean plane, in which three hexagons meet at each internal vertex. The internal angle of a...原创 2019-09-25 19:32:40 · 166 阅读 · 0 评论 -
Keiichi Tsuchiya the Drift King (几何题)
题目:Drifting is a driving style in which the driver uses the throttle, brakes, clutch, gear shifting and steering input to keep the car in a state of oversteer while manoeuvring from turn to turn. As ...原创 2019-09-22 16:36:26 · 296 阅读 · 0 评论 -
Distance
题目:There are n points on a horizontal line, labelled with 1 through n from left to right.The distance between the i-th point and the (i+1)-th point is ai.For each integer k ranged from 1 to n, you ...原创 2019-09-22 16:06:17 · 184 阅读 · 0 评论 -
Kinds of Fuwas
题目:In the year 2008, the 29th Olympic Games will be held in Beijing. This will signify the prosperity of China as well as becoming a festival for people all over the world.The official mascots of Be...原创 2019-09-19 19:26:24 · 201 阅读 · 0 评论 -
Light bulbs
Light bulbs欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入Light...原创 2019-09-18 23:13:59 · 194 阅读 · 0 评论 -
Nim(尼姆游戏)
尼姆游戏的规则:有n堆石子,数量分别是{a1,a2,a3,…,an},两个玩家轮流拿石子,每次从任意一堆中拿走任意数量的石子,拿到最后一个石子的玩家获胜。尼姆游戏有个极为简单的判断胜负的方法,即做异或运算(在这之前要了解一下巴什游戏中的P-position和N-position)定理:若a1⊕a2⊕a3⊕…⊕an!=0则先手必胜,此时是N-position若a1⊕a2⊕a3⊕…⊕an=...原创 2019-10-16 21:07:46 · 7670 阅读 · 0 评论