11 2019 档案
摘要:B. Obtain Two Zeroes time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given two in
阅读全文
摘要:题目: 给定一个数组 {3, 1, 2, 1} 和一个数字k =4。求这个数组的一个最长连续子数组,这个最长连续子数组中所有数字的和必须小于或等于k。 例如,上面这个例子中,连续子数组有这么多种情况: {3}, {1}, {2}, {1}, {3, 1}, {1, 2}, {2, 1}, {3, 1
阅读全文
摘要:A - How Many Tables #include<iostream> using namespace std; const int maxn = 1050; int set[maxn]; void init_set() { for(int i=0;i<=maxn;++i)set[i]=i;
阅读全文
摘要:给定一个非负整数数组,你最初位于数组的第一个位置。 数组中的每个元素代表你在该位置可以跳跃的最大长度。 判断你是否能够到达最后一个位置。 示例 1: 输入: [2,3,1,1,4]输出: true解释: 我们可以先跳 1 步,从位置 0 到达 位置 1, 然后再从位置 1 跳 3 步到达最后一个位置
阅读全文
摘要:一个机器人位于一个 m x n 网格的左上角 (起始点在下图中标记为“Start” )。 机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为“Finish”)。 问总共有多少条不同的路径? 例如,上图是一个7 x 3 的网格。有多少可能的路径? 说明:m 和 n 的值均不
阅读全文
摘要:第一次完完整整的用py写代码,而且是动态规划,虽然这是一个最最基础的动态规划,但是ac的时候还是好开心,先不到人生中第一个一发ac的动态规划是用py过的 给定不同面额的硬币 coins 和一个总金额 amount。编写一个函数来计算可以凑成总金额所需的最少的硬币个数。如果没有任何一种硬币组合能组成总
阅读全文
摘要:哈夫曼树,第一行输入一个数n,表示叶结点的个数。 需要用这些叶结点生成哈夫曼树,根据哈夫曼树的概念,这些结点有权值,即weight,题目需要输出哈夫曼树的带权路径长度(WPL)。 输入格式: 第一行输入一个数n,第二行输入n个叶结点(叶结点权值不超过1000,2<=n<=1000)。 输出格式: 在
阅读全文
摘要:用爱发电 题目描述 Lyh学长用爱发电,为亲爱的学弟学妹们讲解c和c++,然而艰苦的条件限制着学长的发挥。学长的工作区上可能会出现一些地方无法写字! 假设有一个矩形背景,左下角的坐标为(0,0),学长矩形工作区的左下角坐标和右上角坐标为(x1,y1),(x2,y2),两个无法写字的矩形区域的左下角坐
阅读全文
摘要:A - N皇后问题 #include<iostream> #include<cmath> #include<string.h> using namespace std; int n,tot=0; int col[12]={0}; bool check(int c,int r) { for(int i
阅读全文
摘要:A - 圆桌问题: HDU - 4841 #include<iostream> #include<vector> #include<stdio.h> #include<string> using namespace std; int main() { vector<int> table; int n
阅读全文
摘要:题目: 某省自从实行了很多年的畅通工程计划后,终于修建了很多路。不过路多了也不好,每次要从一个城镇到另一个城镇时,都有许多种道路方案可以选择,而某些方案要比另一些方案行走的距离要短很多。这让行人很困扰。现在,已知起点和终点,请你计算出要从起点到终点,最短需要行走多少距离。 Input本题目包含多组数
阅读全文
摘要:题目: Problem DescriptionFor a group of people, there is an idea that everyone is equals to or less than 6 steps away from any other person in the group
阅读全文
摘要:打印从n个数的全排列: #include<iostream> #include<algorithm> #include<ctime> #define Swap(a,b) {int temp=a;a=b;b=temp;} using namespace std; int data[]={1,2,3,4
阅读全文
摘要:#include<iostream> #include<algorithm> using namespace std; int main() { int data[4]={5,2,1,4}; sort(data,data+4); do { for(int i=0;i<4;++i) { cout<<d
阅读全文
摘要:给定一个非空整数数组,除了某个元素只出现一次以外,其余每个元素均出现两次。找出那个只出现了一次的元素。 说明: 你的算法应该具有线性时间复杂度。 你可以不使用额外空间来实现吗? 示例 1: 输入: [2,2,1]输出: 1示例 2: 输入: [4,1,2,1,2]输出: 4 来源:力扣(LeetCo
阅读全文
摘要:给定一个包含 0, 1, 2, ..., n 中 n 个数的序列,找出 0 .. n 中没有出现在序列中的那个数。 示例 1: 输入: [3,0,1]输出: 2示例 2: 输入: [9,6,4,2,3,5,7,0,1]输出: 8说明:你的算法应具有线性时间复杂度。你能否仅使用额外常数空间来实现? 来
阅读全文
摘要:添加注释版本: /* cout<<i<<endl<<" 结点 | data | weight | lchild | rchild | parent "<<endl; for(int i=1;i<=m;++i) { cout<<i<<" | "<<HT[i].data<<" | "<<HT[i].we
阅读全文
摘要:A - Red and Black There is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile.
阅读全文
摘要:题目: 给定一个大小为 n 的数组,找到其中的众数。众数是指在数组中出现次数大于 ⌊ n/2 ⌋ 的元素。 你可以假设数组是非空的,并且给定的数组总是存在众数。 示例 1: 输入: [3,2,3]输出: 3示例 2: 输入: [2,2,1,1,1,2,2]输出: 2 来源:力扣(LeetCode)链
阅读全文
摘要:题目: 给定两个字符串 s 和 t ,编写一个函数来判断 t 是否是 s 的字母异位词。 示例 1: 输入: s = "anagram", t = "nagaram"输出: true示例 2: 输入: s = "rat", t = "car"输出: false说明:你可以假设字符串只包含小写字母。
阅读全文
摘要:八数码求最短步数: #include<queue> #include<stdio.h> #include<iostream> #include<string.h> using namespace std; const int LEN = 362880; struct node { int state
阅读全文
摘要:#include<stdio.h> #define MAX_LEN 1000 void build_tree(int arr[],int tree[],int node,int start,int end) { /* int arr[]: y int tree[]: int node:树的根节点 i
阅读全文
摘要:# encoding: utf-8 #题目是:在arr中选出一堆数字,选出的数字不能是与它相邻的,然后使得选出的数字之和最大 import numpy as np arr=[1,2,4,1,7,8,3] #递归写法 def rec_opt(arr,i): if i==0: return arr[0]
阅读全文
摘要:查源码发现v5可以覆盖sreed[0],这样这个随机数列就可控了 在随机种子这里我一开始使用devC++来生成,居然结果跟gcc的不一样
阅读全文
摘要:步骤: 找到lv6的购买出,修改折扣买lv6 ;然后找到admin的登陆界面,JWT破解,登陆admin ;点击一键成为大会员,利用python反序列化漏洞读取flag 解析: 这题师傅们的WP已经很详细了,我就记录一下我自己不懂的点 import pickle import urllib clas
阅读全文
摘要:步骤: 1.运行这个: <?php class User { public $db; } class File { public $filename; } class FileList { private $files; public function __construct() { $file =
阅读全文
摘要:步骤: nickname[]=wherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewherewhere
阅读全文
摘要:1.在注册后发现这个界面,猜测是不是存在注入点 http://654000be-ea72-4eae-8074-c6cf2798c9e9.node3.buuoj.cn/view.php?no=1and1 http://654000be-ea72-4eae-8074-c6cf2798c9e9.node3
阅读全文
摘要:第二单元:helloword.c #include "windows.h" #include "tchar.h" int _tmain(int argc,TCHAR *argv[]) { MessageBox(NULL, "Hello world!", "WWW.baidu.com", MB_OK)
阅读全文