Skip to content

Instantly share code, notes, and snippets.

View cohalz's full-sized avatar
🌴
On vacation

cohalz cohalz

🌴
On vacation
View GitHub Profile
"http://d.hatena.ne.jp/osyo-manga/20140121/1390309901
"元との違いはカーソル下が記号の場合、空白区切りの単位でハイライトするようにしたこと
" 1 が設定されていれば有効になる
let g:enable_highlight_cursor_word = 1
augroup highlight-cursor-word
autocmd!
autocmd CursorMoved * call s:hl_cword()
autocmd ColorScheme * highlight CursorWord gui=underline guifg=#aa2222
-- 与えられた座標列のn階差分商を求める関数
diffmethod :: [(Double, Double)] -> Double
diffmethod [x0] = snd x0
diffmethod [x0,x1] = (snd x1 - snd x0) / (fst x1 - fst x0)
diffmethod lst = (diffmethod (tail lst) - diffmethod (init lst))
/ (fst (last lst) - fst (head lst))
-- 第一引数に与えられた座標列から第二引数のy座標を補完し返す関数
newtonPoly :: [(Double, Double)] -> Double -> Double
newtonPoly [] _ = 0
"http://d.hatena.ne.jp/osyo-manga/20140121/1390309901
"上記のサイトのコードをカーソル下が記号列でも割と動くように改良
" 1 が設定されていれば有効になる
" let g:enable_highlight_cursor_word = 0
let g:enable_highlight_cursor_word = 1
augroup highlight-cursor-word
main = do
putStrLn $ a ++ " " ++ b where
a = "hello"
b = "world"
{-
以下どちらも嫌
main = do
putStrLn $ a ++ " " ++ b
let $SSH_ASKPASS = simplify($VIM . '/../../MacOS') . '/macvim-askpass'
set noimdisable
set imdisableactivate
if has('gui_macvim')
set guioptions-=T
set showtabline=0
set imdisable " IME OFF
set guioptions-=T " ツールバー非表示
set nocompatible
set hidden
filetype off
set autoread
set noswapfile
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim
call neobundle#rc(expand('~/.vim/bundle'))
endif
#include<stdio.h>
#define ITEM 128
int Item[ITEM + 1][4];
void ZAQ(int item, int grade, int prise, int MAX){
int i;
for (i = 0; i < item; i++){
if (Item[i][3] == 0 && grade + Item[i][1] <= MAX){
Item[i][3] = 1;
#include<stdio.h>
#define MAX 128
int Item[MAX][2];
int n; //アイテムの数
int total = 0; //総額の最大値
int maxSize; //ナップサックのサイズ
void knapsack(int tmpSumSize, int tmpSumPrice, int count){
int i;
//count番目から初めて、重複したものを探さないようにする。
#include <stdio.h>
int main(void){
int n;
int i,j;
int max; //最大サイズ
int sum = 0; //総価値を覚える
int tmps = 0; //サイズの和
int tmpw = 0; //価値の和
int item[64][2];
printf("n = ");
set nocompatible
set hidden
filetype off
set autoread
set noswapfile
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim
call neobundle#rc(expand('~/.vim/bundle'))
endif