考的时候出金公式推错了,后面改了改。输入0.006时,输出是104.55,记不得测试用例给的104.多少了,希望大佬们指点一下#include <iostream>#include <vector>using namespace std;int main() {double p;double sum = 0.0;vector<double> a(91);cin >> p;a[0] = 1;a[1] = p;double tmp = a[1];for (int i = 2; i <= 89; i++) {a[i] = a[i-1] * (1 - p);tmp += a[i];}a[90] = 1 - tmp;//for (int i =1; i <= 90; i++) cout << a[i] << endl;vector<double> res(181);res[1] = a[1] / 2;for (int i = 2; i <= 180; i++) {double tmp = 0.0;for (int j = 1; j <= i; j++) {if (j <= 90) tmp += a[j] * 0.5 * a[i - j];}res[i] = tmp;}//for (int i = 90; i <= 180; i++) cout << res[i] << endl;for (int i = 1; i <= 180; i++) sum += i * res[i];cout << sum;}