发表了博客
2018/04/18 12:33

292C Beautiful IP Addresses

传送门 题目 The problem uses a simplified TCP/IP address model, please read the statement carefully. An IP address is a 32-bit integer, represented as a group of four decimal 8-bit integers (without leading zeroes), separated by commas. For example, record 0.255.1.123 shows a correct IP address and records 0.256.1.123 and 0.255.1.01 do not. In the given problem an arbitrary group of four 8-bit...

0
0
发表了博客
2019/06/20 09:52

Beautiful Soup模块使用

### **1.Beautiful Soup模块的介绍** * Beautiful Soup 是一个可以从HTML或XML文件中提取数据的Python库,简单来说,它能将HTML的标签文件解析成树形结构,然后方便地获取到指定标签的对应属性,还可以方便的实现全站点的内容爬取和解析; * Beautiful Soup支持Python标准库中的HTML解析器,还支持一些第三方的解析器,如果我们不安装它,则 Python 会使用 Python默认的解析器; lxml 是python的一个解析库,支持HTML和XML的解析...

0
1
发表了博客
2018/12/16 18:09

CF1093D Beautiful Graph

思路: 题目倒是没啥好说的,就是注意memset的效率问题。如果循环多次调用memset去初始化一个比较大的数组,那就会很费时间。就是因为这个被hack了。:( 实现: 1 #include <bits/stdc++.h> 2 using namespace std; 3 typedef long long ll; 4 5 const int MOD = 998244353; 6 const int MAXN = 300005; 7 8 vector<int> G[MAXN]; 9 int col[MAXN]; 10 int n, m; 11 ll c1 = 0, c2 = 0, bin[MAXN]; 12 1...

0
0
发表了博客
2019/04/23 10:21

D. Beautiful Array

time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given an array aa consisting of nn integers. Beauty of array is the maximum sum of some consecutive subarray of this array (this subarray may be empty). For example, the beauty of the array [10, -5, 10, -4, 1] is 15, and the beauty of the array [-3, -5, -1] is 0. You may choose ...

0
0
发表了博客
2015/09/07 18:44

python Beautiful Soup库

Beautiful Soup -HTML和XML的解析器 http://www.crummy.com/software/BeautifulSoup/bs4/doc/ apt-get install python-bs4 html_doc = """<html><head><title>The Dormouse's story</title></head> <body> <p class="title"><b>The Dormouse's story</b></p> <p class="story">Once upon a time there were three little sisters; and their names were <a href="http://example.com/elsie" class="sist...

0
2
发表了博客
2018/08/06 21:42

HDU 6351 Beautiful Now(DFS)

Beautiful Now Time Limit: 5000/2500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others) Total Submission(s): 750 Accepted Submission(s): 259 Problem Description Anton has a positive integer n, however, it quite looks like a mess, so he wants to make it beautiful after k swaps of digits. Let the decimal representation of n as (x1x2⋯xm)10 satisfying that 1≤x1≤9, 0≤xi≤9 (2≤i≤m), w...

0
0
发表了博客
2018/06/29 21:31

【CF55D】Beautiful numbers(动态规划)

#【CF55D】Beautiful numbers(动态规划) ##题面 洛谷 CF ##题解 数位$dp$ 如果当前数能够被它所有数位整除,意味着它能够被所有数位的$lcm$整除。 所以$dp$的时候前面所有数的$lcm$要压进$dp$值中。 又因为$lcm$的余数也是有意义的,但是又不能暴力记, 所以记录一下$[1,9]$所有数的$lcm$也就是$2520$就好了。 但是数组太大,实际上,有意义的$lcm$个数只有不到$50$个,重新编号就可以压缩状态了。 #include<iostream> #incl...

0
0
2020/11/16 15:42

windows下安装Beautiful Soup模块

Beautiful Soup是一个非常流行的python库。Beautiful Soup可以解析网页并提供定位内容的便捷接口。下面来讲一下Beautiful Soup的安装过程。 Python3一定要安装beautifulsoup4的版本,其它版本安装不上。 工具/原料 windows 已安装的python Beautiful Soup包 方法/步骤 方法一:win+r键打开运行窗口,输入cmd,进入命令提示符窗口,输入pip install beautifulsoup4,安装成功后界面如下所示。 方法二:进入beautiful soup的官网(...

0
0
发表了博客
2019/12/06 22:42

[Codeforces 1265E]Beautiful Mirrors

Description 题库链接 一共有 $n$ 个关卡,你初始在第一个关卡。通过第 $i$ 个关卡的概率为 $p_i$。每一轮你可以挑战一个关卡。若通过第 $i$ 个关卡,则进入第 $i+1$ 个关卡,否则重新回到第 $1$ 个关卡。通过第 $n$ 个关卡则算成功。问期望多少轮游戏才能成功。 $1\leq n\leq 2\cdot 10^5$ Solution 设从第 $i$ 个关卡通关的期望为 $E_i$。显然 $$ E_i=p_i(E_{i+1}+1)+(1-p_i)(E_1+1) $$ 特别地,$E_{n+1}=0$,且答案为 $E_1$。...

0
0
发表了博客
2018/08/07 14:49

【HDOJ6351】Beautiful Now(贪心,搜索)

题意:给定一个数字n,最多可以交换其两个数位k次,求交换后的最大值与最小值,最小值不能有前导0 n,k<=1e9 思路: 当k>=n的位数时只需要无脑排序 k<n时有一个显然的贪心是从高位到低位,如果当前位置不是可取的最值的话就从比现在低的位置挑一个最值换上来 问题在于可能有多个低位上的数字相同,而且这个问题没有正确的贪心策略 所以只能记录下它们的位置,依次搜索 搜索最小值时第一位不能是0 1 #include<cstdio> 2 #in...

0
0
发表了博客
2019/04/23 07:58

CodeForces-1155D Beautiful Array

Description You are given an array $a$ consisting of $n$ integers. Beauty of array is the maximum sum of some consecutive subarray of this array (this subarray may be empty). For example, the beauty of the array [10, -5, 10, -4, 1] is 15, and the beauty of the array [-3, -5, -1] is 0. You may choose at most one consecutive subarray of $a$ and multiply all values contained in this subarray by $x...

0
0
发表了博客
2019/04/12 14:01

Beautiful Numbers(牛客网)

链接:https://ac.nowcoder.com/acm/problem/17385 来源:牛客网 题目描述 NIBGNAUK is an odd boy and his taste is strange as well. It seems to him that a positive integer number is beautiful if and only if it is divisible by the sum of its digits. We will not argue with this and just count the quantity of beautiful numbers from 1 to N. 输入描述: The first line of the input is T(1≤ T ≤ 100), whic...

0
0
发表了博客
2019/01/03 16:27

Leetcode 667. Beautiful Arrangement II

###题目 链接:https://leetcode.com/problems/beautiful-arrangement-ii/ **Level: ** Medium Discription: Given two integers n and k, you need to construct a list which contains n different positive integers ranging from 1 to n and obeys the following requirement: Suppose this list is [a1, a2, a3, ... , an], then the list [|a1 - a2|, |a2 - a3|, |a3 - a4|, ... , |an-1 - an|] has exactly k distinct i...

0
0
发表了博客
2015/12/17 19:43

python-61: Beautiful Soup 4

前面已经列举出来了很多爬虫有用的工具列表,我们不用每一个都学习,只要选择你喜欢的工具来学习就行,要知道自己的目的,自己想学什么,大部分的工具网上都有资料,只要感兴趣,应该很容易学习的 我们接下来学习一下BS4,为什么要学习这个呢? 因为我在前面查资料的时候看到好多人都使用BS4,也有好多人说BS4是最好的html解析工具,这引起了我很大的兴趣,我想看看究竟BS4为什么得到这么多人的推崇 OK,我们已经想好了要学BS4...

0
2
发表了博客
2016/01/09 18:50

Beautiful Soup 中文文档

Beautiful Soup 中文文档 http://www.crummy.com/software/BeautifulSoup/bs3/documentation.zh.html 原文 by Leonard Richardson(leonardr@segfault.org) 翻译 by Richie Yan(richieyan@gmail.com) ###如果有些翻译的不准确或者难以理解,直接看例子吧。### 英文原文点这里 Beautiful Soup 是用Python写的一个HTML/XML的解析器,它可以很好的处理不规范标记并生成剖析树(parse tree)。 它提供简单又常用的导航(navigating),...

0
3
发表了博客
2020/02/09 14:47

[LeetCode] 932. Beautiful Array 漂亮数组

<br> For some fixed `N`, an array `A` is *beautiful* if it is a permutation of the integers `1, 2, ..., N`, such that: For every i < j, there is no k with i < k < j such that A[k] * 2 = A[i] + A[j]. Given N, return any beautiful array A. (It is guaranteed that one exists.) Example 1: Input: 4 Output: [2,1,4,3] Example 2: Input: 5 Output: [3,1,2,5,4] Note: 1 <= N <= 1000 <br> 这道题定义了一种漂...

0
0
发表了博客
2018/12/17 19:27

python-Beautiful rose

热爱python,热爱生活,python需要浪漫,让我带大家走进浪漫的国度...写的不好的地方请大佬指教 import turtle import time class Rose: def __init__(self): self.interface() @classmethod def interface(cls): print('你喜欢玫瑰吗?') lst = ['喜欢','不喜欢'] for index,hobby in enumerate (lst,1): print(index,hobby) while True...

0
0
没有更多内容
加载失败,请刷新页面
点击加载更多
加载中
下一页