This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int i=1; | |
int count = 0; | |
for(i=1;i<2017;i++) | |
{ | |
if(i%20 < i%16) | |
{ | |
count++; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<math.h> | |
//台形公式に用いる関数をここで定義 | |
double func(double x) | |
{ | |
return (x*x); | |
} | |
//シンプソンの台形公式の定義 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<math.h> | |
/* | |
少なくとも1回カードが排出される確率f(n,p)=1-(1-p)^n | |
において、n,pの情報からf(n,p)を求める | |
*/ | |
double ProbabilityAtReastOneTime(int n,double p) | |
{ | |
//例外の値が入力されたときは、仕方なく0を返す | |
if(n < 0 || p < 0 || p > 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# coding: UTF-8 | |
# サイコロを100回振った時の出目をシュミレーション(モンテカルロ法) | |
# 乱数は1〜6が同様に出る乱数(恐らく一様乱数)を使用 | |
# 詳細は「http://qiita.com/yubais/items/bf9ce0a8fefdcc0b0c97」 | |
import numpy as np | |
N= 100 #サイコロを振る回数 | |
list = np.arange(N) | |
num = np.zeros(7) | |
for n in range(0,N): | |
#ここが計測手法f(X)の部分(1〜6の出目を生成) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define N 100 | |
#include<stdio.h> | |
#include<math.h> | |
int main() | |
{ | |
int i=0; | |
double a[N+1]; | |
double b[N+1]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
import math | |
import time | |
from decimal import * | |
N = 3 # 試行回数 | |
a = [] | |
b = [] | |
t = [] | |
p = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
import numpy | |
import pylab | |
import math | |
import time | |
X = 0 # 的に当たった回数 | |
N = 500 # 試行回数 | |
# N回の試行を開始 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding:utf-8 -*- | |
import numpy | |
import pylab | |
import math | |
import time | |
X = 0 # 的に当たった回数 | |
N = 10000 # 試行回数 | |
# 四分円の境界の方程式[y=√1-x^2 (0<=x<=1)]を描画 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1位 | 178.3 | |
---|---|---|
2位 | 132.8 | |
3位 | 104.5 | |
4位 | 70.2 | |
5位 | 68.2 | |
6位 | 67.8 | |
7位 | 62.1 | |
8位 | 57.2 | |
9位 | 53.1 | |
10位 | 52.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
#include<math.h> | |
//毎度おなじみ階乗の計算 | |
long int fact(int n) | |
{ | |
if(n == 0) | |
{ | |
return 1; | |
} |