Skip to content

Instantly share code, notes, and snippets.

@mattsan
mattsan / file0.cpp
Created March 19, 2013 10:53
第8回オフラインリアルタイムどう書くの参考問題の回答例。C++で。 ref: http://qiita.com/items/24258931dd7ab0acfd49
#include <iostream>
#include <sstream>
#include <string>
static const std::string NIBBLES[] =
{
"0000", "1000", "0100", "1100", "0010", "1010", "0110", "1110",
"0001", "1001", "0101", "1101", "0011", "1011", "0111", "1111"
};
@mattsan
mattsan / file0.cpp
Created March 19, 2013 23:52
第8回オフラインリアルタイムどう書くの参考問題の回答例。C++で。その2 ref: http://qiita.com/items/1af0536fa20bc26ec0fb
#include <iostream>
#include <sstream>
#include <string>
static const std::string NIBBLES[] =
{
"0000", "1000", "0100", "1100", "0010", "1010", "0110", "1110",
"0001", "1001", "0101", "1101", "0011", "1011", "0111", "1111"
};
@mattsan
mattsan / file0.cpp
Created March 20, 2013 01:28
第8回オフラインリアルタイムどう書くの問題の回答例。C++で。 ref: http://qiita.com/items/dda2aecceaaa1ca713a6
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <vector>
#include <utility>
typedef std::pair<int, int> Pos;
typedef std::vector<Pos> Positions;
<?xml version="1.0" encoding="UTF-8"?>
<dcase:dcase xmlns:dcase="http://www.dependable-os.net/2010/06/dcase" id="emsample2">
<dcase:description/>
<dcase:properties/>
<dcase:nodes>
<dcase:node type="Goal" id="goal1" name="Goal_1">
<dcase:description>GOAL ONE</dcase:description>
<dcase:properties/>
</dcase:node>
<dcase:node type="Evidence" id="evidence1" name="Evidence_1">
require 'savon'
client = Savon::Client.new(wsdl: "http://localhost:3000/rumbas/wsdl")
p client.operations
result = client.call(:concat) do
message a: "123", b: "abc"
end
@mattsan
mattsan / org16boseg.cpp
Created December 14, 2013 06:32
第16回オフラインリアルタイムどう書く C++で ref: http://qiita.com/emattsan/items/cd021643f3b926436331
#include <string>
#include <algorithm>
#include <sstream>
#include <cstdlib>
static const int table[][6] =
{
{0,0,0,0,0,0}, {1,0,0,0,0,0}, {1,0,0,0,0,0}, {0,1,0,0,0,0},
{1,0,0,0,0,0}, {2,0,0,0,0,0}, {0,1,0,0,0,0}, {0,0,1,0,0,0},
{1,0,0,0,0,0}, {2,0,0,0,0,0}, {2,0,0,0,0,0}, {1,1,0,0,0,0},
@mattsan
mattsan / Permutation.cpp
Created February 22, 2014 12:31
Permutation
#include "Permutation.h"
namespace emattsan
{
unsigned long long factorial(int n)
{
static std::vector<unsigned long long> memo({1});
while(memo.size() <= n)
{
@mattsan
mattsan / file0.cpp
Created April 5, 2014 13:08
第20回オフラインリアルタイムどう書くの問題をC++で解く ref: http://qiita.com/emattsan/items/ee27bbd8965ec73b7add
#include <iostream>
#include <sstream>
#include <iomanip>
#include <iterator>
#include <algorithm>
#include <utility>
#include <vector>
#include <bitset>
typedef std::bitset<24 * 60> TimeSlot;
@mattsan
mattsan / file0.cpp
Created April 12, 2014 11:41
第20回オフラインリアルタイムどう書くの問題をC++で解く その2 ref: http://qiita.com/emattsan/items/3913c5124a84abe74ffe
#include <iostream>
#include <sstream>
#include <iomanip>
#include <string>
#include <map>
inline int toMin(int hm)
{
return (hm / 100) * 60 + (hm % 100);
}
@mattsan
mattsan / file0.cpp
Created April 20, 2014 06:39
第19回オフラインリアルタイムどう書くの参考問題をC++で解く ref: http://qiita.com/emattsan/items/b68e7cd2ad0ada116c4a
#include <iostream>
#include <sstream>
#include <vector>
#include <bitset>
#include <algorithm>
#include <iterator>
class Sanwa
{
public:
static const int UPPER_LIMIT = 120;