CC

自然万物都趋向从有序变得无序

0%

requests模块

基本发送请求方式

1
2
3
4
5
6
r = requests.get('https://api.github.com/events')
r = requests.post('http://httpbin.org/post', data = {'key':'value'})
r = requests.put('http://httpbin.org/put', data = {'key':'value'})
r = requests.delete('http://httpbin.org/delete')
r = requests.head('http://httpbin.org/get')
r = requests.options('http://httpbin.org/get')

其中 r 为Response对象。

阅读全文 »

re库

re模块用于python的正则表达式,可以从复杂的字符串中获得自己想要的内容,优点 是操作简单,缺点就是效率较低。

基本函数

re.match()函数: 尝试从字符串的起始位置匹配一个模式,如果不是起始位置匹配成功的话,match()就返回none。匹配成功re.match方法返回一个匹配的对象。

阅读全文 »

​ 刚刚好的退役贴–告别大学两年的acm生涯

​ 大学入校就决定参加这个社团,这个组织,因为听过可以提高自己的编写代码的能力。转眼两年过去了,高高兴兴的苦逼的学了两年,总计参加了两场邀请赛,四场区域赛,拿了三铁三铜,没有银,说到底还是很遗憾的。

​ 感觉还是很搞笑(悲伤)的,第一场ccpc哈尔滨区域赛以罚时爆炸喜获铁牌一枚,最后一场icpc焦作同样因为罚时爆炸喜获铜牌一枚,感觉都是sb题,但是不知道为什么总会去踩那些坑。

阅读全文 »

题目链接


Problem Description

The BFS algorithm is defined as follows.

  1. Consider an undirected graph with vertices numbered from 1 to n. Initialize q as a new queue containing only vertex 1, mark the vertex 1 as used.
  2. Extract a vertex v from the head of the queue q.
  3. Print the index of vertex v.
  4. Iterate in arbitrary order through all such vertices uu that uu is a neighbor of vv and is not marked yet as used. Mark the vertex u as used and insert it into the tail of the queue q.
阅读全文 »

题目链接


Problem Description

Niuniu has learned prefix sum and he found an interesting about prefix sum.

Let’s consider (k+1) arrays a[i] (0 <= i <= k)

The index of a[i] starts from 1.

a[i] is always the prefix sum of a[i-1].

“always” means a[i] will change when a[i-1] changes.

“prefix sum” means a[i][1]=a[i1][1]anda[i][j]=a[i][j1]+a[i1][j]a[i][1] = a[i-1][1] and a[i][j] = a[i][j-1] + a[i-1][j] (j >= 2)

阅读全文 »


题目链接


Problem Description

The coach of a football team, after suffering for years the adverse comments of the media about his tactics, decides to take his revenge by presenting his players in a line-up in such a way that the TV cameras would be compelled to zigzag in a ridiculous bobbing motion, by alternating taller and shorter players. However, the team captain objects that he must be the first of the line by protocolary reasons, and that he wants to be seen in the best possible light:

阅读全文 »

题目链接


Problem Description

世界杯正如火如荼地开展!度度熊来到了一家酒吧。 有 N 对情侣相约一起看世界杯,荧幕前正好有 2×N 个横排的位置。 所有人都会随机坐在某个位置上。 当然,如果某一对情侣正好挨着坐,他们就会有说不完的话,影响世界杯的观看。 一般地,对于一个就座方案,如果正好有 K 对情侣正好是挨着坐的,就会产生 DK 的喧闹值。 度度熊想知道随机就座方案的期望喧闹值。 为了避免输出实数,设答案为 ans,请输出 ans×(2N)! mod P 的值。其中 P=998244353

阅读全文 »

题目链接


Problem Description

Alice and Bob are trying to communicate through the internet. Just assume that there are N routers in the internet and they are numbered from 0 to N-1. Alice is directly connected to router 0 and Bob is directly connected to router N-1. Alice initiates the connection and she wants to send S KB of data to Bob.

阅读全文 »