上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页
摘要: Problem Description You are given an undirected graph consisting of nn vertices and mm edges. Your task is to find the number of connected components 阅读全文
posted @ 2021-03-04 18:58 mikku 阅读(80) 评论(0) 推荐(0)
摘要: 题目链接 一开始没注意到他的边是非负就是双向的。所以一直wa…… 用SPFA。bfs判断是否有一个点进入次数超过n即可。 #include <algorithm> #include<iostream> #include<cstdio> #include<cstring> #include<vecto 阅读全文
posted @ 2021-03-03 20:00 mikku 阅读(49) 评论(0) 推荐(0)
摘要: 题目链接 使用优先队列优化后的Dijkstra即可。 注意优先队列默认是大堆顶。(即大数在前) 可以用priority_queue<int,vector<int>,greater<int>>q; 来改写成小堆顶来寻找最小距离。 #include <algorithm> #include<iostre 阅读全文
posted @ 2021-03-03 17:16 mikku 阅读(120) 评论(0) 推荐(0)
摘要: 题目链接 反向建边+dfs。从最大值开始搜索。 AC代码如下: #include <algorithm> #include<iostream> #include<cstdio> #include<cstring> #include<vector> #include<queue> #define MA 阅读全文
posted @ 2021-03-03 16:34 mikku 阅读(49) 评论(0) 推荐(0)
摘要: Problem Description You are given an array aa consisting of n integers. In one move, you can jump from the position ii to the position i−ai (if 1≤i−ai 阅读全文
posted @ 2021-03-02 17:25 mikku 阅读(44) 评论(0) 推荐(0)
摘要: Problem Description 小时候,你一定玩过七巧板对吧?由七块彩色的方块组成,能够拼成各种有趣而生动的图案。 shenyunhan 发明了一种新的玩具叫方块板,它由大大小小的矩形方块组成。如下图所示,方块板玩具是由若干块不同颜色的小矩形方块组成的大矩形方块。 我们将这个方块板玩具视为二 阅读全文
posted @ 2021-03-01 19:34 mikku 阅读(104) 评论(0) 推荐(0)
摘要: Problem Description 泰泰学长喜欢玩数字(不知道什么奇怪的癖好)。他在黑板上写下一个数字 x ,然后进行 n-1 次以下两种操作: x 除以3 (必须能整除才能进行,即 x mod 3=0) x 乘以2 每次操作完成后,泰泰学长在黑板上写上这个操作后的新数字,并让这个新数字作为新的 阅读全文
posted @ 2021-03-01 15:23 mikku 阅读(63) 评论(0) 推荐(0)
摘要: Description - 题目描述 给定若干位十进制数,你可以通过选择一个非空子集并以某种顺序构建一个数。剩余元素可以用相同规则构建第二个数。除非构造的数恰好为0,否则不能以0打头。举例来说,给定数字0,1,2,4,6与7,你可以写出10和2467。当然写法多样:210和764,204和176,等 阅读全文
posted @ 2021-02-28 18:33 mikku 阅读(54) 评论(0) 推荐(0)
摘要: Problem Description In the game of Sudoku, you are given a large 9 × 9 grid divided into smaller 3 × 3 subgrids. For example, . 2 7 3 8 . . 1 . . 1 . 阅读全文
posted @ 2021-02-27 20:45 mikku 阅读(70) 评论(0) 推荐(0)
摘要: 题目链接 DLX例题(洛谷模板题就是省选难度了qwq)。 DLX的具体思想我就不赘述了,网上有很多讲的不错的。下附链接 网站1,网站2,网站3,网站4 AC代码如下(代码思路就看注释吧……) #include<iostream> #include<cstdio> #include<cstring> 阅读全文
posted @ 2021-02-26 20:24 mikku 阅读(74) 评论(0) 推荐(0)
上一页 1 2 3 4 5 6 7 8 9 ··· 12 下一页