考研 408 × 求职面试
知识点 · 计算机网络 · 进阶
每日一题 · 计算机网络
解析
面试小贴士 · 计算机网络
代码实现 · C
#include <stdio.h>
int main() {
double file_MB = 2.0; // 文件大小,按 1 MB=10^6 B
double bw_Mbps = 100.0; // 链路带宽 Mbps
double distance_km = 1000.0; // 距离 km
double prop_speed = 2e8; // 传播速度 m/s
double data_bits = file_MB * 8 * 1e6;
double tx = data_bits / (bw_Mbps * 1e6);
double prop = (distance_km * 1000.0) / prop_speed;
double total = tx + prop;
double throughput = data_bits / total / 1e6; // Mbps
double bdp = bw_Mbps * 1e6 * prop / 8.0; // Byte
printf("发送时延=%.6f s\n", tx);
printf("传播时延=%.6f s\n", prop);
printf("总时延=%.6f s\n", total);
printf("吞吐量=%.2f Mbps\n", throughput);
printf("时延带宽积=%.2f Byte\n", bdp);
return 0;
}