##課題2 研究室配属決定問題
###Q.
80名の学生が8つの研究室に配属される。学生が希望順位を申請し,できるだけ希望を叶える配属先を決定する最適解探索問題と考える時,これを全数探索(全ての場合の評価値を計算)する場合の候補数の数を,研究室の定員が10名丁度とする場合と,定員数に制限がない場合(1研究室に80名が集中しても可)について,それぞれ計算せよ
また、毎秒1,000万回評価値を計算できる計算機でどれくらいの時間(もしくは日数や年数)がかかるかをそれぞれ計算せよ
###A.
定員数10とする場合
(aCb) は a個 から b個 を取る組み合わせの数
(80C10) * (70C10) * ... * (10C10)
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
<?php | |
require './lib/TwistOAuth.php'; | |
//endpoint https://api.twitter.com/1/account/generate.json | |
$num = 19; | |
$sn_base = '****'; | |
$password = "****"; | |
$shift = 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
<?php | |
$col_width = 3; | |
$title_format = '-*- Y-m -*-'; | |
// 引数がない場合は今月 | |
$ts = strtotime("first day of"); | |
if (isset($argv[2])) { | |
$ts = strtotime("first day of {$argv[1]}-{$argv[2]}"); | |
} | |
list($y, $m, $t, $w) = explode(',', date('Y,m,t,w', $ts)); |
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
----- 0 ----- | |
40 | |
[0.01884ms] | |
----- 1 ----- | |
600 | |
[0.00381ms] | |
----- 2 ----- |
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
var heatmap = new google.maps.visualization.HeatmapLayer({ | |
fillOpacity: 1.1, | |
radius: 50, | |
gradient: ['#fff', '#f00', '#f80', '#8f0', '#0f0', '#0f8', '#08f', '#00f', '#80f', '#f08', 'black'] | |
}); | |
heatmap.setData(point); | |
heatmap.setMap(map); |
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
statuses/mentions_timeline | |
statuses/user_timeline | |
statuses/home_timeline | |
statuses/retweets_of_me | |
statuses/retweets/:id | |
statuses/show/:id | |
statuses/destroy/:id | |
statuses/update | |
statuses/retweet/:id | |
statuses/update_with_media |
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
<?php | |
/* 1 */ | |
$kuji = ['大吉', '小吉', '吉', '凶']; | |
for ($i = 0; $i < 10000000; $i++) { | |
echo $kuji[array_rand($kuji)] . PHP_EOL; | |
} | |
// /\v(大吉\n){11} |
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
<?php | |
/* | |
* TwitterAPI1.1 url snippets 生成 | |
*/ | |
require_once('./simple_html_dom.php'); | |
/*【保存版】TwitterAPI1.1 REST API 全項目解説 | DX.univ */ | |
$url = 'http://dx.24-7.co.jp/twitterapi1-1-rest-api/'; | |
$html = file_get_html($url); |
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
snippet statuses/home_timeline | |
abbr 自分のホームタイムラインツイート一覧を取得 | |
options word | |
statuses/home_timeline | |
snippet statuses/mentions_timeline | |
abbr 自分のメンション付きツイート一覧を取得 | |
options word | |
statuses/mentions_timeline |
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 -*- | |
u"""BINGO の確立をシミュレーションするスクリプト | |
input: | |
times = 抽選機を回す回数, card_num = カードの数 | |
outpu: | |
1本でも揃う確立 | |
""" | |
import sys |