0x00 问题描述

现在我还在管理的游戏服务器最近上了对象存储加上七牛的全球CDN加速,来给国外的玩家进行资源下载的加速。由于现在很多脚本还在完善,会经常更新服务器上的脚本,这导致缓存在CDN和对象存储上的文件和服务器上的不一致。所以需要加一个程序来刷新不一致文件在对象存储和CDN上的缓存。七牛云的API为了保证每一个操作不被篡改,使用了HMAC-SHA1算法对所有请求进行了加密。并且为了传参的安全还对参数进行了Base64编码。

- 阅读剩余部分 -

0x00 问题描述

An IP is a single IP address, a slice of bytes. Functions in this package accept either 4-byte (IPv4) or 16-byte (IPv6) slices as input.
GO的net库接受以4字节或16字节切片组成的IPv4和IPv6地址

Note that in this documentation, referring to an IP address as an IPv4 address or an IPv6 address is a semantic property of the address, not just the length of the byte slice: a 16-byte slice can still be an IPv4 address.
已知IPv4单位最大255,占8-bit,也就是1-byte,一共占4位,公共就是4-byte。
而IPv6地址单位最大65535占2-byte,一共8位,总共占16-byte.
所以无论是IPv4还是IPv6,一个16-byte长度的切片足以存储上述IP地址。所以go语言net库的IP地址是一16-byte大小的切片储存的。





- 阅读剩余部分 -

0x00 问题描述

众所周知,目前市面上的游戏加速器普遍只加速热门网游。很多冷门游戏,包括一些单机改联机的游戏都无法通过市面上主流加速器优化网络速度。之前我就遇到让我很恶心的意见事情,就是,我为了玩战术小队的国内服务器特意充值了某游戏加速器,但是登陆游戏后才发现只有服务器搜索功能被加速了,进入服务器后依然是延迟超高,丢包难以忍受。客服只是简单一句,游戏内的个人服务器是不会被加速的,并且拒绝为我退款。

- 阅读剩余部分 -

0x00 问题描述

Roman numerals are represented by seven different symbols: I, V, X, L, C, D, and M.
罗马数字以下列字母组成

Symbol       Value
I             1
V             5
X             10
L             50
C             100
D             500
M             1000

For example, “two” is written as II in Roman numeral, just two one's added together. Twelve is written as, XII, which is simply X + II. The number twenty-seven is written as XXVII, which is XX + V + II.
例如,数字2的罗马数字为II,相当于两个1相加。12则以XII表示,24的罗马数字为XXVII,相当于XX+V+II.

Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not IIII. Instead, the number four is written as IV. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as IX. There are six instances where subtraction is used:
罗马数字顺序是从左到右,最左边是最大值,最右为最小值。然而阿拉伯数字4并不是以IIII来表示,罗马数字中的4是以IV表示的。同样9对应的是IV。

I can be placed before V (5) and X (10) to make 4 and 9.
X can be placed before L (50) and C (100) to make 40 and 90.
C can be placed before D (500) and M (1000) to make 400 and 900.

Given a roman numeral, convert it to an integer. Input is guaranteed to be within the range from 1 to 3999.
系统将输入一个罗马数字,将其转化为阿拉伯数字整数输出。该输入的范围将被限制在1-3999

Example:

Input: "III"
Output: 3

Input: "IV"
Output: 4

Input: "MCMXCIV"
Output: 1994
Explanation: M = 1000, CM = 900, XC = 90 and IV = 4.






- 阅读剩余部分 -

0x00 问题描述

Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.
判断一个整数是否为palindrome (如果一个整数正序等于倒序则是palindrome)

Example:

Input: 121
Output: true

Input: 10
Output: false
Explanation: Reads 01 from right to left. Therefore it is not a palindrome.

Input: -121
Output: false
Explanation: From left to right, it reads -121. From right to left, it becomes 121-. Therefore it is not a palindrome.

- 阅读剩余部分 -