Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View meki's full-sized avatar
🏠
Working from home

Satoshi Sashida meki

🏠
Working from home
View GitHub Profile
#include <iostream>
#include <set>
using namespace std;
int main() {
typedef std::multiset<int> MySet;
MySet heightSet;
for(int i = 0; i < 10; ++i)
@meki
meki / AOJ_0001_List_of_Top_3_Hills.py
Last active August 29, 2015 13:55
AOJ_0001_PYTHON
# 配列を作成
n = list()
for var in range(0, 10):
# 標準入力から一行読み込み
# int にキャスト
n.append( int(raw_input()) )
# 配列を降順ソート
n.sort(reverse = True)
<?php
$hi = fopen('php://stdin', "r");
$ho = fopen('php://stdout', "w");
# 空の配列を作成
$arr = array();
# 標準入力からデータをセット
for($i = 0; $i < 10; $i++)
{
-- テーブルの作成
create table tbl(height integer);
-- テキストファイルからデータを読み込む
.import data.txt tbl
-- 'tbl' から 'height' フィールドで降順ソートして 3 行読み込む
select * from tbl order by height desc limit 3;
@meki
meki / AOJ_0001_List_of_Top_3_Hills.lisp
Last active August 29, 2015 13:55
AOJ_0001_Common Lisp
;; 標準入力から n 回受け取ってリストに追加
(defun input (lst n)
(cond
((eq (length lst) n)
lst
)
(t
(input (append lst (list (read)) ) n )
)
)
@meki
meki / file0.cpp
Last active August 29, 2015 14:07
STL コンテナを代入できる選択ソートテンプレート関数 ref: http://qiita.com/_meki/items/f655af1a911db7ee9798
#include <iostream>
#include <list>
using namespace std;
//! 選択ソートテンプレート関数
template <typename InIt, typename Pred>
void select_sort(InIt init, InIt last, Pred pred)
{
for(InIt curr = init; curr != last; ++curr)
@meki
meki / file0.java
Last active August 29, 2015 14:08
クラスにリスナインターフェースとオブザーバリストメンバ変数を追加するマクロ ref: http://qiita.com/_meki/items/b631e8f51aa8db00ff9e
class Foo extends View.OnClickListener {
@meki
meki / file0.java
Created December 3, 2014 12:08
Canvas を使ってタイル画像を敷き詰める ref: http://qiita.com/_meki/items/a9a465d1d03c0340ad25
/**
* タイル画像をキャンバス上に敷き詰める.
* @param canvas 描画用キャンバス.
* @param resource リソースオブジェクト.
* @param resourceId タイル画像のリソースID.
*/
public static void fillByTile(@NonNull Canvas canvas,
@NonNull Resources resource,
@DrawableRes int resourceId)
{
@meki
meki / file0.cs
Created January 3, 2015 05:08
C# プログラムからワード文書を作成編集する方法 ref: http://qiita.com/_meki/items/ef064d8861bda4363562
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.Office.Interop.Word;
using Word = Microsoft.Office.Interop.Word;
namespace WordSample
{
@meki
meki / CurryImpl.h
Created March 28, 2015 11:21
C++ でカリー化関数を書いてみる(2変数限定) ref: http://qiita.com/_meki/items/742ce9788f03cee51070
/** A -> (B -> C) 型の関数オブジェクト */
template <typename A, typename B, typename C>
struct CurryImpl {
// コンストラクタでオリジナルの関数をキャプチャ
CurryImpl(function<C(A, B)>& f) : mFunc(f) {}
/** B -> C 型の関数オブジェクトをリターンする */
function< C(B) > operator () (A& a) {
return CurryImpl2(mFunc, a);