This file contains hidden or 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
| import numpy as np | |
| EPS = 1e-7 | |
| def Givens(i, j, theta, n): | |
| res = DMatrix([1]*n) | |
| res[i, j] = np.sin(theta) | |
| res[j, i] = -np.sin(theta) |
This file contains hidden or 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
| function createHTMLDraftInGmail(to, title, contents) { | |
| var forScope = GmailApp.getInboxUnreadCount(); // needed for auth scope | |
| var htmlBody = "<p>Hello, I am an HTML message</p><hr>"; | |
| var mail = [ | |
| "To: $to", | |
| "Subject: =?utf-8?B?$subject?=", | |
| "MIME-Version: 1.0", | |
| "Content-Type: text/plain; charset=UTF-8", |
This file contains hidden or 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<iostream> | |
| #include<algorithm> | |
| #include<cmath> | |
| #include<vector> | |
| using namespace std; | |
| #define EPS 1e-9 | |
| #define N 7 |
This file contains hidden or 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
| def add(array, size, max_size, x): | |
| if size == max_size: | |
| new_array = malloc(2*max_size) | |
| for x in [0..max_size-1]: | |
| new_array[x] = array[x] | |
| max_size *= 2 | |
| array = new_array | |
| array[size + 1] = x | |
| return (array, size, max_size) |
This file contains hidden or 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
| def qsort(list): | |
| pibot = list[0] | |
| left = listのうち値がpibotより小さいもの | |
| center = listのうち値がpibotと同じもの | |
| right = listのうち値がpibotより大きいもの | |
| return qsort(left) + center + qsort(right) |
This file contains hidden or 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
| def merge(node): | |
| if node == NULL: return [] | |
| left = merge(node.left_child) | |
| right = merge(node.left_child) | |
| if len(left) < len(right): | |
| swap(left, right) #rightの方を小さくする | |
| res = combine(left, right) #O(RlogL) | |
| return res.insert(node.val) | |
| def combine(left, right): |
This file contains hidden or 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
| def sort(list): | |
| if list = 空: | |
| return list | |
| left = list の左半分 ## O(N) | |
| right = list の右半分 ## O(N) | |
| left = sort(left) ## F(N/2) | |
| right = sort(right) ## F(N/2) | |
| return combine(left, right) ## C(N) | |
| def combine(lista, listb): |
This file contains hidden or 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.2人の幼女のケーキ分け | |
| 2.2人の幼女の数あて | |
| 3.3人の幼女の数あて | |
| 4.5人の幼女の山分け | |
| 5.5人の幼女の組あて | |
| 6.13人の幼女とトランプの館 | |
| 7.23人の幼女と石像の館 |
This file contains hidden or 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 q1(); | |
| int q2(); | |
| int q3(); | |
| int q4(); | |
| int q5(); | |
| int q6(); | |
| int q7(); | |
| char* q8(); |
This file contains hidden or 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
| ##Q.1 | |
| print "trats"[::-1] | |
| ##Q.2 | |
| print 8 not in range(7,8) | |
| ##Q.3 | |
| print 0.0 is 0 | |
| ##Q.4 |