2011-10-01から1ヶ月間の記事一覧

epoch@まつやまの予選通過!

通らないと思ってたepochの予選が去年についで今年も無事通過しました。予想外なのでかなりうれしい。なぜ通らないと思ってたかはあとから書きます。 相方は@wand125(id:w125)で、チーム名はもふもふあるぱか。去年のチーム名はふわふわどーなつでした。由来…

Problem 92

#include <iostream> #include <sstream> #include <string> #include <algorithm> #include <vector> #include <queue> #include <set> #include <map> #include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> using namespace std; #define FOR(i,k,n) for(int i=(k); i<(int)n; ++i) #define REP(i,…</cmath></cstring></cstdlib></cstdio></map></set></queue></vector></algorithm></string></sstream></iostream>

Problem 59

#! /usr/bin/env ruby # coding: utf-8 text = gets.chomp asciis = text.split(',').map{|c| c.to_i} 'aaa'.upto('zzz'){|word| key = word.bytes.to_a str = asciis.zip(key.cycle).map{|c| (c[0]^c[1]).chr}.join if str.index("this") and str.index("th…

Problem 63

#! /usr/bin/env ruby # coding: utf-8 def count(n) return 0 if(n < 1) 1.upto(10){|x| y = x**n if y >= 10**(n-1) return 9 - x + 1 end } end n = 1 ans = 0 loop do break if count(n) == 0 ans += count(n) n += 1 end puts ans

Problem 49

#! /usr/bin/env ruby # coding: utf-8 require 'prime' require 'bsearch' primes = [] #4桁の素数リスト Prime.each{|prime| if prime > 10000 break elsif prime > 1000 primes.push(prime) end } primes.combination(2){|p1,p2| p3 = 2*p2 - p1 #p1,p2,p…