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
# 2〜99のカードの中から2枚取り、その2つの数の和だけをAさんに、積だけをBさんに教えた時の会話が | |
# A「Bさん、わかりませんね」 | |
# B「お、ならわかった」 | |
# A「なら僕もわかった」 | |
# となった場合、2つの数字はそれぞれ何でしょう。なお、AさんとBさんはそれぞれ完璧に合理的に発言しています。 | |
# (Aさんが一言目をしゃべっているとき、すでに「Bさんがまだわかっていないこと」を察してる前提) | |
class Candidate | |
def initialize(low, high) | |
@low = low |
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
if (isIE9()) { | |
// https://github.com/mzabriskie/axios/blob/master/lib/core/Axios.js | |
const keys = ['post', 'patch', 'put']; | |
const origPostFetcher = fetcher.post.bind(fetcher); | |
['post', 'patch', 'put'].forEach((key) => { | |
fetcher[key] = function(url, data, config) { | |
if (data && data.toPlainObject) { | |
data = data.toPlainObject(); | |
} | |
if (key !== 'post') { |
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
const createEach = (withIndex) => { | |
return withIndex ? | |
(arr, iterator) => arr.forEach((elem, index) => iterator(elem, index)) : | |
(arr, iterator) => arr.forEach((elem) => iterator(elem)); | |
}; | |
const createMap = (withIndex) => { | |
return withIndex ? | |
(arr, iterator) => arr.map((elem, index) => iterator(elem, index)) : | |
(arr, iterator) => arr.map((elem) => iterator(elem)); |
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
package calendar; | |
public class Calendar { | |
public static final int[] DAY_NUMS = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; | |
public static final String[] Days = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; | |
public static final int BASIS_YEAR = 2014; | |
public static final int BASIS_JAN_1ST_DAY_INDEX = 3; // Wed | |
NewerOlder