⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main6.cpp.txt

📁 use GA to deal with 随机机会约束规划
💻 TXT
字号:
// Monte Carlo Simulation
// Written by Microsoft Visual C++
// Copyright by UTLab @ Tsinghua University
// http://orsc.edu.cn/UTLab

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "UTLab.h"

main()
{
  int i, k=0, n=3000;
  double a, b, c;

  for(i=1; i<=n; i++) {
	  a=myexp(1);
	  b=myn(2,1);
	  c=myu(0,3);
	  if((a+b*b+c*c*c)<=30) k++;
  }

  printf("L = %3.4f\n",(double)k/n);
  return 1;
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -