#include<stdio.h>
#include<stdlib.h>
#include<math.h>
#include <complex.h>
int d()
{
double i;
i = rand();
if (i > 0.5)
return 1;
else
return -1;
}
void main()
{
double smax;
double _Complex z= 0.0 + 1.0 * _Complex_I;
int t;
smax = 0;
for (int i = 1; i <= 100; i++) {
double s;
s = 0;
for (int q = 0; q <= 3199; q++)
{
t = d();
s = s + t * (exp(3.125 * z * q) - 2.7183);
}
if (s > smax)
smax = s;
}
printf("%d", smax);
}
uj5u.com熱心網友回復:
_Complex換成小寫的uj5u.com熱心網友回復:
有啥問題 報啥錯你貼出來啊 我這兒運行是正確的轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/61568.html
標籤:C語言
