Skip to content

Instantly share code, notes, and snippets.

@pogin503
pogin503 / poker.hs
Last active August 29, 2015 13:58
第一回 オフラインリアルタイムどう書くの参考問題 http://qiita.com/Nabetani/items/cbc3af152ee3f50a822f
import Data.List (group, sort)
-- import Debug.Trace
-- @see http://qiita.com/Nabetani/items/cbc3af152ee3f50a822f
{-
一枚のカードは、スートを表す文字+ランクを表す文字列 で構成される。
スートを表す文字は、S, H, D, C のいずれか
ランクを表す文字列は、2, 3, ..., 9, 10, J, Q, K, A のいずれか
下表の役に対応すること。下表の役に該当しない場合は '--' を出力すること。
カードはジョーカーを含まない52枚から5枚が選ばれる。
Process: ruby [26761]
Path: /Users/USER/*/ruby
Identifier: ruby
Version: 0
Code Type: X86-64 (Native)
Parent Process: zsh [90695]
Responsible: iTerm [261]
User ID: 501
Date/Time: 2014-07-17 11:10:52.803 +0900
source 'https://rubygems.org'
gem 'chef'
gem 'knife-solo'
gem 'berkshelf'
pogin ~/workspace/vagrant/precise32
➤ gem uninstall yajl && gem install yajl
ERROR: Could not find a valid gem 'yajl' (>= 0) in any repository
ERROR: Possible alternatives: yacl, yaji, yajm, yawl
pogin ~/workspace/vagrant/precise32
➤ bundle exec gem uninstall yajl && bundle exec gem install yajl
ERROR: Could not find a valid gem 'yajl' (>= 0) in any repository
ERROR: Possible alternatives: yacl, yaji, yajm, yawl
pogin ~/workspace/vagrant/precise32
➤ gem list
*** LOCAL GEMS ***
bigdecimal (1.2.4)
io-console (0.4.2)
json (1.8.1)
minitest (4.7.5)
psych (2.0.5)
pogin ~/workspace/ruby
➤ rbenv global system
------------------------------------------------------------
pogin ~/workspace/ruby
➤ rbenv rehash
------------------------------------------------------------
pogin ~/workspace/ruby
➤ gem list
*** LOCAL GEMS ***
$ emacs --help
Usage: emacs [OPTION-OR-FILENAME]...
Run Emacs, the extensible, customizable, self-documenting real-time
display editor. The recommended way to start Emacs for normal editing
is with no options at all.
Run M-x info RET m emacs RET m emacs invocation RET inside Emacs to
read the main documentation for these command-line arguments.
#include "stdio.h"
#include <cmath>
#include <iostream>
#include <vector>
#include <sstream>
#include <iomanip>
typedef std::vector<int> VI;
typedef std::vector<VI> VVI;
#include <iostream>
#include <vector>
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
using namespace std;
int main(){
int n;
cin >> n;
import Control.Applicative
import Data.List (group)
data RunLength b = Multiple Int b | Single b | Empty deriving (Show, Eq)
encodeModified :: String -> [RunLength Char] -> [RunLength Char]
encodeModified str acc = do
let rlItem = calcRunlength 0 str
case fst rlItem of
"" -> acc ++ [snd rlItem]