| Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|
| 79696 | sh25_huangse | 地球人口承载力估计 | C++ | Accepted | 0 MS | 248 KB | 406 | 2026-01-04 14:37:11 |
#include <iostream> #include <iomanip> // 用于控制输出格式 using namespace std; int main() { int x, a, y, b; cin >> x >> a >> y >> b; // 关键:使用 double 类型进行计算,避免整数除法丢失精度 double z = (double)(y * b - x * a) / (b - a); // 输出结果,保留两位小数 cout << fixed << setprecision(2) << z << endl; return 0; }