paiza POH hatsukoi #_poh


私がやりたかったPOHはこういうものでは断じてない。

HAIR

ショートヘアセット

tyama_poh1a.rb
#!/usr/bin/ruby
n=gets.to_i
s=gets.chomp
n.times{puts s}

ロングヘアセット

tyama_poh1b.rb
#!/usr/bin/ruby
puts gets.to_i%7==0 ? :lucky : :unlucky

ポニーテールセット

tyama_poh1c.rb
#!/usr/bin/ruby
puts $<.count{|e|a=e.split;a[0]==a[1]}<3 ? :NG : :OK

ツインテールセット

tyama_poh1d.rb
#!/usr/bin/ruby
s='-'*gets.to_i
s[gets.to_i-1]='+'
puts s

おさげ

tyama_poh1e.rb
#!/usr/bin/ruby
t,n,*a=`dd`.split.map &:to_i;t*=60;puts (0...n).find{|i|0>t-=a[i]}||:OK

EYE

たれ目

tyama_poh2a.rb
#!/usr/bin/ruby
a,b=gets.split.map(&:to_i)
puts a<b ? :NG : :OK

つり目

tyama_poh2b.rb
#!/usr/bin/ruby
n=gets.to_i
t=n/100
t+=10 if n>=1000
p t

めがね

tyama_poh2c.rb
#!/usr/bin/ruby
n=gets.to_i
p gets.split.map(&:to_i).sort[n/2]

CLOTHES

Cute衣装

tyama_poh3a.rb
#!/usr/bin/ruby
n,m=gets.split.map(&:to_i)
puts m%n==0 ? :ok : :ng

Sexy衣装

tyama_poh3b.rb
#!/usr/bin/ruby
n,m=gets.split.map(&:to_i)
n-=m
p n>0 ? n : 0

制服

tyama_poh3c.rb
#!/usr/bin/ruby
T=Hash[%w(3 4 5 6 7 8 9 10 J Q K A 2).each_with_index.to_a]
a=gets.split
k=rank=pass=0
card=-1
(0..1/0.0).each{|_|
    i=_%a.size
    pass+=1
    if a[i].is_a?(Integer)
        k+=1
        break if k==a.size
    else
        k=0
        if pass>=a.size || T[a[i]]>card
            card=T[a[i]]
            a[i]=rank+=1
            pass=0
        end
    end
}
puts a

浴衣

tyama_poh3d.rb
#!/usr/bin/ruby
a=[0]*24
gets.to_i.times{
    x,y=gets.split
    a[x.to_i] += y=='in' ? 5 : 3
}
r=c=0
24.times{|i|
    c+=a[i]
    if c>0
        c-=1
        r+=2
    else
        r+=1
    end
}
p r

SPECIAL

水着

tyama_poh4a.rb
#!/usr/bin/ruby
gets
h=Hash.new(0)
gets.chomp.chars{|c|h[c]+=1}
g=Hash.new(0)
gets.chomp.chars{|c|g[c]+=1}
p g.keys.map{|k|n=g[k]-h[k];n>0 ? n : 0}.reduce(:+)

マイク

tyama_poh4b.rb
#!/usr/bin/ruby
n,m=`dd`.split.map(&:to_i)
p (m+2*n-1)/(2*n)

カチューシャ

tyama_poh4c.rb
#!/usr/bin/ruby
n,a,m,b=`dd`.split.map(&:to_i)
p n*a+(n+m-1)/m*b