###HTTP的问题:
- 传输过程没加密
- 不能确保对方是正牌的服务器
- 不能确保传输过程中没有被调包
举个例子讲就是,你要让快递把一个包裹寄给你朋友。有如下问题:
# http://news.sina.com.cn/s/wh/2018-03-02/doc-ifyrztfz6281140.shtml | |
def main(): | |
ans = [None for _ in range(10+1)] | |
def least_answered(ans): | |
vs = ans[1:] | |
vc = {v:vs.count(v) for v in vs} | |
minc = min(vc.values()) | |
for v,c in vc.items(): |
def main(n): | |
delta = [(1,0), (0,1), (-1,0), (0,-1)] | |
arr = [[0 for _ in range(n)] for _ in range(n)] | |
row,col,k,di = -1,0,1,0 | |
while k <= n*n: | |
row += delta[di][0] | |
col += delta[di][1] | |
if not 0 <= row < n or not 0 <= col < n or arr[row][col] > 0: | |
row -= delta[di][0] | |
col -= delta[di][1] |
class Node: | |
def __init__(self, v, n=None): | |
self.v = v | |
self.n = n | |
def do_print(head: Node): | |
t = head | |
print('=====') | |
while t is not None: | |
print(t.v) |
def main(a): | |
a = abs(a) | |
b = a | |
c = 0 | |
while b > 0: | |
c = c * 10 + b % 10 | |
b //= 10 | |
print(c == a) | |
if __name__ == '__main__': |
# 模拟这个题目的过程 | |
# https://mp.weixin.qq.com/s?__biz=MzIzMTc0NzAwMA==&mid=2247483759&idx=1&sn=933d3522dcc197b547696ad522652b8b&key=281224a0b07438ec8edb2e3a289a23f072754ac6a4b26d9e3ce3e38cca13ec9be38b36c21c8340b80c94deb264a2ff916029a398d55725d4128d04bbbef6653083d77490729372eca7851e6b4673eac2&ascene=0&uin=MTQ0OTk4MDMwMA%3D%3D&devicetype=iMac+MacBookPro11%2C1+OSX+OSX+10.12.4+build(16E195)&version=12020510&nettype=WIFI&fontScale=100&pass_ticket=1TrgoYI6A%2Fe9EM1BEXmWAwjoNDPwfCcCsU5W1LgXMf%2BV1wgkhzYikLhX8b3Ru9op | |
import numpy as np | |
import matplotlib.pyplot as plt | |
def f0(xarr, a, c, d): | |
l = [] | |
cyclelen = d + 1.0 * c / a | |
for x in xarr: |
/** | |
* Codes to implement the approximation of compute(x) of paper https://arxiv.org/pdf/1702.07825.pdf | |
*/ | |
import java.util.Random; | |
public class Test { | |
static float eTilde(float x) { | |
final float x2 = x * x; | |
final float x4 = x2 * x2; |
public class Untitled { | |
public static void main(String[] args) { | |
final int N = 9; | |
int[][] a = new int[N][N]; | |
int x = -1; int y = 0; | |
int dx = 0; int dy = -1; | |
int k = 1; |
package info.gooooloo; | |
public class MyLineInfo { | |
public static String info() { | |
final StackTraceElement element = new Exception().getStackTrace()[1]; | |
return String.format("%s#%s,%s:%d", | |
element.getClassName(), | |
element.getMethodName(), | |
element.getFileName(), | |
element.getLineNumber()); |
package com.qidu.lin; | |
public class PrinterNumbers | |
{ | |
/** | |
* 打印螺旋矩阵 | |
0 31 30 29 28 27 26 25 24 | |
1 32 55 54 53 52 51 50 23 | |
2 33 56 71 70 69 68 49 22 | |
3 34 57 72 79 78 67 48 21 |