滚木-牛吃草求解器
#include<iostream>
#include<cmath>
using namespace std;
int main(){
int a, b, c, d;
cout << "输入a只牛吃b天,c只牛吃d天:" << endl;
cout << "a b c d = ";
cin >> a >> b >> c >> d;
double x = abs(c * d - a * b) * 1.0 / abs(b - d);
cout<<"每天新生草量可供 "<<x<<" 头牛吃1天"<<endl;
return 0;
}
这代码是豆包写的。

浙公网安备 33010602011771号