阪大理学部科学計算・開発サークル -Circle for Science Caluculation and Development-
http://w.atwiki.jp/cscd/
阪大理学部科学計算・開発サークル -Circle for Science Caluculation and Development-
ja
2014-11-24T19:41:00+09:00
1416825660
-
部門/Google Chrome/検索エンジンの追加
https://w.atwiki.jp/cscd/pages/259.html
#html2(){<blockquote class="twitter-tweet" lang="en"><p>chromeの検索エンジンの管理で"<a href="http://t.co/GMoyejxbNF">http://t.co/GMoyejxbNF</a>"とか"<a href="http://t.co/OA7FBdZeT8">http://t.co/OA7FBdZeT8</a>"とか追加しておくとアドレスバーから直で行けて便利</p>— Rin (@poecilorhyncha) <a href="https://twitter.com/poecilorhyncha/status/533886708274589696">November 16, 2014</a></blockquote>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>}
を見て他も追加してみようと。
**arXiv
http://arxiv.org/find/all/1/all:+%s
**NIST XCOM
&del(){今なんか見れないのであとで。}
CGIだから無理だった。
**Weblio 英和和英
http://ejje.weblio.jp/content/?query=%s
**Evernote
https://www.evernote.com/Home.action#st=p&x=%s
ログインした状態で。
**Github Gistの自分のやつを探す
https://gist.github.com/search?q=user%3Apn11+%s
**Amazon
http://www.amazon.co.jp/s/field-keywords=%s
**GoogleでPDFだけ検索
https://www.google.co.jp/search?q=filetype:pdf+%s
*以下は知らぬ間に追加されてた。
**Wolfram Alpha
http://www.wolframalpha.com/input/?i
2014-11-24T19:41:00+09:00
1416825660
-
メンバー/SGHR/topcoder/同じ数字で挟み撃ち
https://w.atwiki.jp/cscd/pages/258.html
*[[問題>https://codeiq.jp/magazine/2014/11/18658/]]
*ジャンル
??
*解説
1からnまでの数字が書かれたカードが2枚ずつ全部で2n枚あり、iとiの間のカードがi枚になるような順列の数を数えよ、という問題。
n=11だと総当りは無理だったのでアルゴリズムを以下のように工夫した。
ちなみに答えは(逆順も含めて)35584通りだった。そんなにあるのか。
1.ある数字iのおく場所jを決める。
2.場所j+i+1にiがおけるか判定する。
3.おければiを1増やして1.に戻る。おけなければjを1増やして1.に戻る。
*コード
#highlight(C++,linenumber){{
#include<cmath>
#include<cstdlib>
#include<string>
#include<sstream>
#include<vector>
#include<iostream>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<algorithm>
using namespace std;
int n = 11;
int ans = 0;
void rec(int i, vector<int> cards){
/*
for(int j=0; j<2*n; j++){
cout << cards[j] << " ";
}
cout << endl;
*/
if(i == n+1){
for(int j=0; j<2*n; j++){
cout << cards[j] << " ";
}
cout << endl;
ans++;
}
else{
for(int j=0; j<2*n; j++){
if(j+i+1 <= 2*n-1){
if(cards[j] == 0 && cards[j+i+1] == 0){
cards[j] = i;
c
2014-11-06T00:31:13+09:00
1415201473
-
メンバー/SGHR/topcoder/NarrowPassage2Easy
https://w.atwiki.jp/cscd/pages/257.html
*[[問題>http://community.topcoder.com/stat?c=problem_statement&pm=13520&rd=16081]]
*ジャンル
幅優先探索
*解説
大きさの違う狼が何匹か狭い路地にいて、二匹の狼の大きさの和が路地の幅より大きいとその二匹はすれ違うことができないとする。
このとき初期配置から狼の順番を入れ替えていって到達できるパターンは何通りか、という問題。
任意の隣り合う二匹をスワップして得られた配置をキューに入れ、そこから到達できるパターンを幅優先で探索。
かぶりがないようセットを使ってすでに探索したパターンは排除する。
*コード
#highlight(C++,linenumber){{
#include<cmath>
#include<cstdlib>
#include<string>
#include<sstream>
#include<vector>
#include<iostream>
#include<queue>
#include<deque>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<algorithm>
using namespace std;
class NarrowPassage2Easy{
public:
int count(vector <int> size, int maxSizeSum) {
int ans = 0;
queue< vector<int> > q;
set< vector<int> > s;
vector<int> v;
v.resize(size.size());
for(int i=0; i<size.size(); i++) v[i] = i;
q.push(v);
while(!q.empty()){
vector<int> v = q.front();
if(s.count(v) == 0){
s.insert(v);
//for(int i=0; i<v.size(); i++) c
2014-11-06T00:22:54+09:00
1415200974
-
メンバー/SGHR/SublimeText
https://w.atwiki.jp/cscd/pages/256.html
長年愛用したemacsを手放しエディタを[[Sublime Text>http://www.sublimetext.com/3]]に変えようかと思案中。
以下、設定メモ。
-導入したパッケージ
--IMESupport : 日本語をインラインで入力できる。
--sublemacspro : emacs風のキーバインド。
--OrigamiEmacs : emacs風のキーバインド。
-Preferences.sublime-settings
#highlight(python,linenumber){{
{
"color_scheme": "Packages/Color Scheme - Default/Monokai.tmTheme",
"ignored_packages": ["Vintage"],
"font_face": "Migu 1M", // font
"font_size": 12, // font size
"highlight_line": true, // 現在行をハイライト
"show_encoding": true, // エンコーディングを表示
"trim_trailing_white_space_on_save": true, // 行末のスペースを削除
"fold_buttons": true, // 折りたたみボタンを表示
"fade_fold_buttons": true, // 折りたたみボタンを隠す
}
}}
-Default (Windows).sublime-keymap
#highlight(python,linenumber){{[
{"keys": ["ctrl+h"], "command": "left_delete"}, // back space
{"keys": ["ctrl+i"], "command": "reindent"}, // reindent
{"keys": ["ctrl+["], "command": "indent"}, // indent
{"keys": ["ctrl+]"], "command": "unindent"}, // unindent
{"keys": ["ct
2014-11-04T11:19:26+09:00
1415067566
-
メンバー/SGHR/topcoder/ApplesAndPears
https://w.atwiki.jp/cscd/pages/255.html
*[[問題>http://community.topcoder.com/stat?c=problem_statement&pm=12935]]
*ジャンル
全探索
*解説
格子状のテーブルの上のりんご(Apple)となし(Pear)の並びが与えられ、K回以内の並べ替えでりんごまたはなしまたは空で埋め尽くせる最大の長方形の面積を求めよ、という問題。
例えば下のような初期状態でK=3のとき
||P|P|
|P|P|A|
|P|A|P|
3回の並べ替えで
|P|P|P|
|P|P|P|
||A|A|
とするのが最大で、このときなしで埋め尽くされた長方形の面積は6となる。
一見どこから手をつければいいかわからない問題であるがアルゴリズムは単純で、考えうる全ての長方形について
+そこに含まれるりんご、なし、空の数を数える。
+K回以内の並べ替えでりんご、なし、空で埋め尽くせるか判定する。
+埋め尽くせる場合はその長方形の面積をSmaxとして更新する。
とすればよく、計算量はO(n^4)である。
見た目は複雑そうだがアルゴリズムは単純な良問。
*コード
#highlight(C++,linenumber){{
#include<cmath>
#include<cstdlib>
#include<sstream>
#include<string>
#include<vector>
#include<iostream>
#include<queue>
#include<deque>
#include<stack>
#include<list>
#include<map>
#include<algorithm>
using namespace std;
#define MAX_N 51
class ApplesAndPears{
public:
map<char, vector< vector<int> > > ref;
int rect(char c, int x0, int y0, int x1, int y1){
vector< vector<int> > table = ref[c];
return table[x1][y1] - tabl
2014-06-19T14:42:54+09:00
1403156574
-
メンバー/SGHR/topcoder/PowerOutage
https://w.atwiki.jp/cscd/pages/254.html
*[[問題>http://community.topcoder.com/stat?c=problem_statement&pm=1697]]
*ジャンル
グラフ
*解説
ループのないグラフが与えられ、すべてのノードを回る最小コストの経路を求めよ、という問題。
深さ優先探索で解く。
*コード
#highlight(C++,linenumber){{
#include<cmath>
#include<cstdlib>
#include<cstdio>
#include<string>
#include<sstream>
#include<vector>
#include<iostream>
#include<queue>
#include<deque>
#include<map>
#include<stack>
#include<list>
#include<algorithm>
using namespace std;
#define MAX_V 50
class PowerOutage {
public:
vector< vector< pair<int, int> > > connect;
int estimateTimeOut(vector <int> fromJunction, vector <int> toJunction, vector <int> ductLength) {
connect.resize(MAX_V);
for(int i=0; i<fromJunction.size(); i++){
connect[fromJunction[i]].push_back(make_pair(toJunction[i], ductLength[i]));
}
return dfs(0);
}
int nodecost(int i){
int c = 0;
for(vector< pair<int,int> >::iterator it = connect[i].begin(); it != connect[i].end(); it++){
c += it->second
2014-06-06T18:38:15+09:00
1402047495
-
部門/Ruby/Evernote APIを使う/PDFから新規ノート作成
https://w.atwiki.jp/cscd/pages/253.html
EvernoteによくPDFを置いておくのだけど、Macに公式のclientを入れておくと全部同期するので容量取るのでじゃま。でもWeb clientは使いにくい。uploadだけでも簡単にやりたかったのでつくった。そのうち検索もつくりたい。
解説はなしで。めもとして置いておく。ほとんどコピペ。Macのmdlsコマンドを使ってる。sandbox=trueかfalseをちゃんと指定しないと動かないっぽい。Oauth使うのめんどうだったのでdeveloper tokenを使った。
**pedf2evernote.rb
https://dev.evernote.com/intl/jp/doc/start/ruby.php を参考につくった。
#highlight(ruby,linenumber){{#!/usr/bin/ruby
# Load libraries required by the Evernote OAuth sample applications
require 'oauth'
require 'oauth/consumer'
# Load Thrift & Evernote Ruby libraries
require "evernote_oauth"
require "./make_note.rb"
def developer_token
YOUR_DEVELOPER_TOKEN
end
client = EvernoteOAuth::Client.new(
token: developer_token,
# sandbox: true
sandbox: false
)
#user_store = client.user_store
#user_store.getUser(developer_token)
note_store = client.note_store
notebooks = note_store.listNotebooks()
notebooks.each do |notebook|
puts "Notebook: #{notebook.name}"
end
filename1 = ARGV[0]
file1
2014-06-01T15:56:50+09:00
1401605810
-
部門/Ruby/Evernote APIを使う
https://w.atwiki.jp/cscd/pages/252.html
[[Getting Started with the Evernote API - Evernote Developers>https://dev.evernote.com/intl/jp/doc/start/ruby.php]]
**コメント
#comment_num2()
2014-06-01T15:38:44+09:00
1401604724
-
部門/TeX/星マークを使う
https://w.atwiki.jp/cscd/pages/251.html
>$\star$
でできる。
*もっと大きめの星がほしい★
>\usepackage{latexsym}
>\usepackage{amssymb}
して
>$\bigstar$
*黒い星じゃいや☆
>\usepackage{MnSymbol}
して
>$\largestar$
*参考リンク
-[[Special Latex Characters>http://www.combinatorics.net/Resources/weblib/A.8/a8.html]]
-[[xetex - Latex command for unfilled \bigstar - TeX - LaTeX Stack Exchange>http://tex.stackexchange.com/questions/156712/latex-command-for-unfilled-bigstar]]
2014-05-14T03:21:10+09:00
1400005270
-
部門/Geant4/回転
https://w.atwiki.jp/cscd/pages/250.html
つくったG4LogicalVolumeを好きな向きに置くには。
なんか理屈はよく分かってないけど毎回リンクを参考にてきとうにやっている。
*参考リンク
-[[geant4>http://be.nucl.ap.titech.ac.jp/~ryuki/iroiro/geant4/]]
-[[Geant4 Tutorial @ Japan 2007>http://www-geant4.kek.jp/g4users/g4tut07/exercise-2.html]]
2014-01-12T19:39:16+09:00
1389523156