跳到主内容
paste
bin
.ca
type · paste · share
⌘
K
登录
?
账户
更多
▾
文档
系列
bin 系列
pastebin.ca
中心
Share text and code with expiry and privacy controls.
imagebin.ca
Upload and share images with direct links.
filebin.ca
Drop a file and get a shareable link.
notebin.ca
Write Markdown notes with durable links.
turl.ca
Short, reputation-checked links.
attn.ca
Notifications and alerts for your services.
voicebin.ca
Record and share short voice clips.
dnsbin.ca
Inspect DNS and debug records.
← 返回文本
›
编辑 / 分支
无标题文本
#2vFJvYEQrB
public / public
新版本
匿名
已创建 2 days ago
过期于 5 days
1.7 KB
语法:
text
你的更改会创建一个链接到此文本的新文本 — 原始文本不变。
新版本
你的更改会创建一个链接到此文本的新文本 — 原始文本不变。
标题(可选)
文件名
语法
text
text
bash
c
cpp
css
diff
dockerfile
go
html
ini
java
javascript
json
kotlin
lua
makefile
markdown
nginx
php
python
ruby
rust
shellscript
sql
swift
toml
typescript
xml
yaml
可见性
公开动态
访问
public
过期
7 天
10 分钟
1 小时
1 天
7 天
30 天
90 天
自定义…
自定义过期
变更备注
(可选)
任何人都能在公开动态中找到此文本。选择“未列出”即可仅通过链接分享。
创建新版本
取消
粘贴或输入…
# estimate.py —— 数制转换与存储容量估算验证脚本 # 单位约定:1 MB = 10^6 B,1 MiB = 2^20 B,1 GB = 10^9 B,1 GiB = 2^30 B def show_num_systems(): print("=== 一、数制转换验证 ===") b = '10110101' print(f"int('{b}', 2) = {int(b, 2)}") # 期望 181 print(f"hex(255) = {hex(255)}") # 期望 0xff print(f"bin(0x1A) = {bin(0x1A)}") # 期望 0b11010 print(f"int('1A', 16) = {int('1A', 16)}") # 期望 26 def photo_size(w=1920, h=1080, depth=24): bits = w * h * depth bytes_ = bits / 8 return bits, bytes_, bytes_ / 1e6, bytes_ / 2**20 def audio_size(minutes=4, sr=44100, bits=16, ch=2): seconds = minutes * 60 bits_total = sr * bits * ch * seconds bytes_ = bits_total / 8 return bits_total, bytes_, bytes_ / 1e6, bytes_ / 2**20 def video_size(hours=2, mbps=8): seconds = hours * 3600 bits_total = mbps * 1e6 * seconds bytes_ = bits_total / 8 return bits_total, bytes_, bytes_ / 1e9, bytes_ / 2**30 def iphone_shot_size(w=2868, h=1320, depth=24): bits = w * h * depth bytes_ = bits / 8 return bits, bytes_, bytes_ / 1e6, bytes_ / 2**20 def report(name, bits, bytes_, dec, bin_): print(f"\n{name}: {bits:,} bit = {bytes_:,.0f} B " f"≈ {dec:.2f} MB/GB ≈ {bin_:.2f} MiB/GiB") if __name__ == '__main__': show_num_systems() print("\n=== 二、存储容量估算 ===") report("1920×1080×24bit 未压缩照片", *photo_size()) report("4分钟 44.1kHz/16bit 双声道音频", *audio_size()) report("2小时 8Mbps 视频", *video_size()) report("iPhone 16 Pro Max 截图 2868×1320×24bit 未压缩", *iphone_shot_size())